[jboss-user] [EJB 3.0] - Re: Lazy loading for OneToOne association (entities share th

akovcic do-not-reply at jboss.com
Thu Aug 10 04:04:16 EDT 2006


For all who hit the same problem here is an update:
Got a confirmation from JBoss support that developer tracked down a bug in Hibernate core (http://opensource.atlassian.com/projects/hibernate/browse/HHH-1992)

As I have uni-directional One-to-One association the workaround in that case is:


  |   /**
  |    * @return Returns the entityC.
  |    */
  | //  @OneToOne(fetch = FetchType.LAZY)
  | //  @PrimaryKeyJoinColumn
  |   @ManyToOne(fetch = FetchType.LAZY)
  |   @JoinColumn(name = "ID", insertable = false, updatable = false)
  |   public EntityC getEntityC() {
  |     return entityC;
  |   }
  | 

Comment from the support:
anonymous wrote : 
  | As for the @OneToOne @JoinColumn workaround.
  | Yes this definitively works and you don't even have to enhance your classes. The proxy based lazy loading works perfectly in this case. 
  | 

Hope this helps

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964269#3964269

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964269



More information about the jboss-user mailing list