-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Unwanted unique constraint in DDL generated from annotations
PostPosted: Mon Jul 30, 2012 10:44 pm 
Newbie

Joined: Mon Jul 30, 2012 10:23 pm
Posts: 1
Hello, I can't seem to figure this out. Hopefully someone knows the answer. We generate our database schema from the annotated classes and the following annotation results in an unwanted unique constraint being created which further causes problems.

Code:
    @OneToMany(
        fetch   = FetchType.LAZY,
        cascade = { CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH }
    )
    @JoinTable(
        name               = "AuthorizationDefSKUOneWayJoin",
        joinColumns        = @JoinColumn(name = "AuthorizationDef_PKID"),
        inverseJoinColumns = @JoinColumn(name = "skus_PKID")
    )
    protected Set<SKU>          skus = ....;


The result of this annotation is create table plus the unique constraint on SKUS_PKID which is "system-generated". In case it matters, this is happening on DB2.

Our classes are also auto-generated from the modeling tool which should explains a weird table name. The annotations are therefore auto-generated but we have the ability to alter them, just as long as I can figure out what is causing the constraint creation.

Nowhere in the generated annotations there is any explicit mention of UniqueConstraint so perhaps it's some setting somewhere. Could it be some property in the persistence.xml?

Thanks,
Henry


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.