users@glassfish.java.net

Re: How to persist an entity with Composite primary key

From: <glassfish_at_javadesktop.org>
Date: Wed, 27 Jun 2007 14:57:43 PDT

Thanks for providing your code samples! Marina is right, your should check the mapping default for field to column names. Try specifying column names using the @Column annotation in the PK class. Are you using pre-defined tables or table generation?

Also: Is the direct relationship between Asset and Resource on purpose?

@Entity
public class Asset implements Serializable {
...
@OneToMany(mappedBy="assetId")
private Set<Resources> resourcesCollection;
...
}

@Entity
public class Resources implements Serializable {
...
@ManyToOne
@JoinColumn(name="Asset_id")
private Asset assetId;
...
}
[Message sent by forum member 'mf125085' (mf125085)]

http://forums.java.net/jive/thread.jspa?messageID=224350