openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Schlaikjer <ha...@cs.cmu.edu>
Subject Re: how to specify index / unique constraint on multiple columns of a container table?
Date Wed, 15 Oct 2008 17:02:20 GMT
Pinaki, thanks for the reply.

I've looked over the tests you'd mentioned. They do elucidate how to 
apply unique constraints on join tables via @JoinTable(uniqueConstraints 
= ...), but don't show how I might accomplish something similar with 
@ContainerTable. Here are relevant direct links:

TestUniqueConstraint.java
http://fisheye6.atlassian.com/browse/openjpa/branches/sql-cache/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/unique/TestUniqueConstraint.java?r=trunk

UniqueA.java
http://fisheye6.atlassian.com/browse/openjpa/branches/sql-cache/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/unique/UniqueA.java?r=trunk

UniqueB.java
http://fisheye6.atlassian.com/browse/openjpa/branches/sql-cache/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/unique/UniqueB.java?r=trunk

I had thought that @ContainerTable was meant to be a corollary to 
@JoinTable, but @ContainerTable lacks a uniqueConstraints element.

@JoinTable
http://java.sun.com/javaee/5/docs/api/javax/persistence/JoinTable.html

@ContainerTable
http://openjpa.apache.org/builds/1.2.0/apache-openjpa-1.2.0/docs/javadoc/org/apache/openjpa/persistence/jdbc/ContainerTable.html

Thoughts?


Pinaki Poddar wrote:
>> Is it possible to specify a unique constraint over multiple columns within
> a container table?
> 
> Yes.
> 
> Please refer to the tests and domain classes of
> org.apache.openjpa.persistence.jdbc.unique package as example.


Mime
View raw message