2 Replies Latest reply on Jun 8, 2006 3:32 AM by Karsten Knecht

    4.0.4.GA - @javax.persistence.OneToOne(mappedBy) with PK as

    Karsten Knecht Newbie

      while migrating from 4.0.4.CR2 to 4.0.4.GA I got:

      2006-05-24 13:43:01,565 DEBUG [org.jboss.ejb3.ServiceDelegateWrapper] Starting failed persistence.units:ear=migpt.ear,unitName=migpt
      org.hibernate.AnnotationException: Unknown mappedBy in: ps.eb.EbMaster.myPkDetail, referenced property unknown: ps.eb.EbPKJoinDetail.myMaster
       at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:127)
       at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1049)
       at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:302)
       at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034)
       at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1015)
       at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
       at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:751)
       at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:350)


      The relation is via primaryKey
      public class EbMaster {
      
       private int id;
       @Id
       @Column(name="id", nullable=false)
       public int getId()
       {
       return id;
       }
       private EbPKJoinDetail myPkDetail;
       @OneToOne(optional=true,mappedBy="myMaster",fetch=FetchType.LAZY)
       public EbPKJoinDetail getMyPkDetail()
       {
       return myPkDetail;
       }
      } // class EbMaster
      public class EbPKJoinDetail {
      
       private int id;
       @Id
       @Column(name="id", nullable=false)
       public int getId()
       {
       return id;
       }
       private EbMaster myMaster;
      @OneToOne(optional=false,fetch=FetchType.LAZY)
      @JoinColumn(name="id",referencedColumnName="id",insertable=false,updatable=false)
       public EbMaster getMyMaster()
       {
       return myMaster;
       }
      } // class EbPKJoinDetail


      this worked with 4.0.4.RC1 and CR2 and I have a lot of such relations within my legacy database.
      Can anyone help me, thanks in advance
      Karsten