Hibernate 2nd level cache one-to-one doesn't work
<p>I use Ehcache provider for Hibernate 2nd level cache. It caches one-to-many collections, annotated with <code>@Cache</code>, but does not cache one-to-one:</p>

<pre><code>//hb annotations
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "user")
public class User {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;

    @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "user")
    @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "details")
    private Details details;

    //getters, setters, constructors etc.

}

//hb annotations
public class Details {

    @GenericGenerator(name = "generator", strategy = "foreign",
    parameters = @Parameter(name = "property", value = "user"))
    @Id
    @GeneratedValue(generator = "generator")
    @Column(unique = true, nullable = false)
    private Integer id;

    @OneToOne
    @PrimaryKeyJoinColumn
    private User user;

    //getters, setters, constructors ets.

}
</code></pre>

<p>I use Spring JpaRepository to fetch the data:</p>

<pre><code>userRepository.findOne(id);
</code></pre>