openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boblitz John <john.bobl...@bertschi.com>
Subject RE: Problem with Criteria-API and fetch (properties of related entities are NULL)
Date Mon, 11 Mar 2013 16:43:07 GMT
Hello,

This may have already been addressed,  but have you looked at you settings for Fetch Groups
and Eager Fetching?  (Part III , 5.7 and 5.8)


John

> -----Original Message-----
> From: Riccardo [mailto:riccardo.nimser@s2000.tu-chemnitz.de]
> Sent: Wednesday, March 06, 2013 8:31 PM
> To: users@openjpa.apache.org
> Subject: Re: Problem with Criteria-API and fetch (properties of related
> entities are NULL)
> 
> 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.

Mime
View raw message