openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: Schema generation with unique constraints
Date Fri, 19 Dec 2008 05:40:32 GMT

This was fixed with revision 713778 [1]

[1]
http://n2.nabble.com/Schema-generation-with-unique-constraints-td1469373.html#a1469373





Claudio Romano-2 wrote:
> 
> Hi all,
> 
> I'm using openjpa version 1.2.0 with HSQLDB and I  have a verty nasty
> problem using schema generator with unique constraints.
> 
> I have to classes to persist:
> 
> public class UniqueA {
>   ...
> 
>   private int uniqueValue;
> 
> }
> 
> public class UniqueB {
>   ...
> 
>   private int uniqueValue;
> }
> 
> 
> The property uniqueValue should be unique for both classes.
> The first thing I used was the @Column annotation:
> @Column(name="uniqueValue", unique = true)
> 
> The schema generator generates follow sql statement
> ...CONSTRAINT UNQ_ UNIQUE (uniqueValue)..
> 
> as soon openjpa generates the second constraint, it will fail because
> the constraint name is not unique.
> 
> 
> 
> The second try was with the @Table annotation:
> "@Table( uniqueConstraints= {@UniqueConstraint(columnNames=
> {"uniqueValue"})})"
> 
> The schema generator generates following sql statement:
> ...CONSTRAINT UNQ_externalRef UNIQUE (uniqueValue)...
> 
> same as before, as soon openjpa generates the second constraint, it will
> fail because the constraint name is not unique.
> 
> 
> This is my openjpa.jdbc.SynchronizeMappings:
> openjpa.jdbc.SynchronizeMappings=buildSchema(ForeignKeys=true,
> Indexes=true)
> 
> 
> So i finally have no solution the let openjpa generate the correct
> schema. What do I do wrong?
> 
> Thank!
> Claudio
> 
> 

-- 
View this message in context: http://n2.nabble.com/Schema-generation-with-unique-constraints-tp1469373p1676552.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message