users@glassfish.java.net

Re: JPA Entity that has no primary key

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Tue, 16 Feb 2010 16:35:48 -0800

A JPA entity needs to have Primary Key that uniquely identifies the
entity. However it is not necessary for the underlying database table to
declare corresponding colums at primary key.
What columns in your table uniquely identifies a row? Choose
corresponding attributes in your entity as Primary Key

On 2/16/2010 2:38 PM, glassfish_at_javadesktop.org wrote:
> I have a table in that doesn't contain any primary key. There are no unique constraints on the table. Constraints-wise, it just contains few columns that has 'not null' requirements. This table is controlled by other application group and as such I can't modify the table definitions.
> I found in some groups that JPA doesn't support entities that has no primary keys. Is this true?
> How should I handle this kind of entity? I am using BEA weblogic server10.0& Eclipse for development.
>
> Thanks in advance.
> [Message sent by forum member 'mac1sam' (mac1sam_at_yahoo.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=387071
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>