7 Replies Latest reply on Jul 8, 2006 2:22 PM by Pete Muir

    the bundled hibernate doesn't work @oneToOne shared primary

    Dan Liu Apprentice

      Here is my code:

      Owner{
      @Id
      public Long getId() { return id; }
      
      @OneToOne(fetch=FetchType.LAZY, cascade=CascadeType.ALL)
      @PrimaryKeyJoinColumn
       public Employment getEmployment() { return employment; }
      }
      
      Employment {
       @Id
       @GenericGenerator(name="fk", strategy="foreign", parameters={
       @Parameter(name="property", value="owner")
       })
       @GeneratedValue(strategy=GenerationType.AUTO, generator="fk")
       @Column(name="owner_id")
       public Long getId(){ return id; }
      
       @OneToOne(mappedBy="employment")
       public AccountOwner getOwner(){ return owner; }
      }
      
      


      Here is the error message I get:
      Unknown mappedBy in: Employment.owner, referenced property unknown: Owner.employment
      


      Any idea?