openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Riccardo <riccardo.nim...@s2000.tu-chemnitz.de>
Subject Issue With Mapping of Derived Identities (JSR 317 section 2.4.1)
Date Wed, 06 Mar 2013 14:36:40 GMT
Hi,

I am using a mapping of derived identities, as specified in the JSR 317
section 2.4.1. My (simplified) Entities look like the following code:

@Entity
public class User implements Serializable {
   @Id
   private Long id;
       
   @Basic
   private String name;

   @Basic
   private String avatar;
   
   @Basic
   private String profile;
     
   @OneToOne(mappedBy = "owner")
   private Inventory inventory;

   ...
}

@Entity
public class Inventory implements Serializable {
   @Id
   @OneToOne(fetch = FetchType.EAGER)
   @JoinColumn(name = "Owner", referencedColumnName = "Id")
   private User owner;
   
   @Basic
   private int slots;
   
   @Basic
   @Enumerated(EnumType.STRING)
   private Visibility visibility;
   
   ...
}

If I search an inventory by its primary key via

    this.manager.find(Inventory.class, someId);

the properties of the owner (User object) are all NULL except the id, and an
additional SELECT is executed if I try to access the properties through the
getter-methods. For me this seems not to be normal and any feedback to this
problem would be welcome.

Regards

Riccardo



--
View this message in context: http://openjpa.208410.n2.nabble.com/Issue-With-Mapping-of-Derived-Identities-JSR-317-section-2-4-1-tp7583025.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.

Mime
View raw message