Hi, http://java.sun.com/javaee/5/docs/api/index.html?javax/persistence/Table.html
As per the above link the one mentioned in openJPA document is supposed to work. (http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_mapping_jpa.html#ref_guide_mapping_jpa_unique) I also saw the following in openJPA example: @Entity @Table(name="ART", uniqueconstrain...@unique(columnNames="TITLE")) public class Article { ... } http://openjpa.apache.org/builds/latest/docs/manual/manual.html#jpa_overview_mapping_identityex Please try if the above works. Regards, Ravi. -----Original Message----- From: Thomas Polliard [mailto:[email protected]] Sent: Tuesday, January 19, 2010 7:50 PM To: [email protected] Subject: Question about Unique Contraint public class Account { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Integer Id = null; @Unique private String accountName = null; @Basic private Date creationDate = null; @ManyToMany(cascade=CascadeType.ALL) private List<Host> hostList = new ArrayList<Host>(); However, in the database it actually doesn't restrict the accountName but rather forces a new ID to be generated with the same accountName. What page can I find out about creating a Unique constraint that mimics this in pseudo database ddl create table Account ( Id int4 PRIMARY KEY, accountname varchar(255) NOT NULL UNIQUE, ..... Thanks for the assistance. Thomas PS: http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_mapping_jpa.html#ref_guide_mapping_jpa_unique Doesn't appear to be the proper Annotation.
