-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How can i write a JPA Entity without a primary Key
PostPosted: Mon Jun 14, 2010 7:20 am 
Newbie

Joined: Sun Aug 09, 2009 12:14 pm
Posts: 16
How can i write a JPA Entity without a primary Key ?
My DB table is combined from two columns (user_id, company_id)
both are foreign keys with manyToOne relation.

Code:
@Entity
@Table(name="COMPANY_CONTACTS")
public class CompanyContacts {
      
   @EmbeddedId
   private CompanyContactsPK companyContactsPK;
   
}
@Embeddable
public class CompanyContactsPK implements Serializable{
   
   private static final long serialVersionUID = -1294432203426788661L;

   @ManyToOne
   @JoinColumn(name = "COMPANY_ID", referencedColumnName = "CMP_COMPANY_ID")
   private Company company;
   
   @ManyToOne
   @JoinColumn(name = "USER_ID", referencedColumnName = "USR_PERSON_ID")
   private User user;
}


Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: hibernateModel.CompanyContacts.company in hibernateModel.Company.companyContacts


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.