I prefer not to change my database schema, but I found another workaround
which works. For this I use the annotation MapsId on the property "owner"
and an additional property "id". (JSR 317, Section 2.4.1.3, Example 4b)
@Entity
public class Inventory implements Serializable {
@Id
private Long id;
@MapsId
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "Owner", referencedColumnName = "Id")
private User owner;
...
}
With these it works as expected, without the need of changing my database
schema. The only property which is still NULL in the user is the
"inventory", which means that the opposite direction of the relation
Inventory <-> User is not set, which is still strange for me.
--
View this message in context:
http://openjpa.208410.n2.nabble.com/Problem-with-Criteria-API-and-fetch-properties-of-related-entities-are-NULL-tp7582995p7583037.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.