[jboss-user] [EJB 3.0] - Problem with composite pk

hudowski do-not-reply at jboss.com
Tue Nov 21 03:27:29 EST 2006


Hi!
I have 2 tables  - documents and scans. One document has one or more scans (OneToMany). Table document has complex primary key on fields docId and docIdVersion. I have a class DocumentPK. In Document entity i have: 

@EmbeddedId
    @AttributeOverrides({
	   @AttributeOverride(name = "docId", column = @Column(name = "docId")),
	   @AttributeOverride(name = "docIdVersion", column = @Column(name = "docIdVersion"))
	})
	public DocumentPK getDocumentPK()
	{
	   return documentPK;
	}

It's great. Problem is how can I make referance from entity Scan (it has the same 2 columns as a FK) to table Document? 

Best regards.
Rafal

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

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



More information about the jboss-user mailing list