-->
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.  [ 4 posts ] 
Author Message
 Post subject: Fixed:How do I encode a <properties> mapping via Annot
PostPosted: Thu Nov 29, 2007 12:57 am 
Newbie

Joined: Sat Oct 07, 2006 4:57 pm
Posts: 7
I am converting my hbm.xml files to annotations. I cannot figure out how to convert the following:

Code:
         <properties name="Group" unique="true">
            <property name="aaa" column="aaa" type="string"/>
            <property name="bbb" column="bbb" type="int" not-null="true"/>
            <property name="ccc" column="ccc" type="int"/>
         </properties>


I have figured out the @Column definitions for aaa, bbb, and ccc, but how do I encode Group via annotations?

I've scoured the documentation and the forums.

Thanks


Last edited by frisbee on Thu Nov 29, 2007 10:09 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 29, 2007 2:14 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
this is not possible today unfortunately. But if you're using properties just for the unique constraint, you can add that constraint in the database later on

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 29, 2007 9:46 pm 
Newbie

Joined: Sat Oct 07, 2006 4:57 pm
Posts: 7
Can I add the "ALTER TABLE x ADD UNIQUE " statement via an annotation
or do I have to manually add it to the DDL from

Code:
generateSchemaCreationScript(new MySQLDialect());


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 29, 2007 10:09 pm 
Newbie

Joined: Sat Oct 07, 2006 4:57 pm
Posts: 7
Cool, I figured this out on my own, er, well at least by reading the docs:

Code:
@Table(name="table",
      uniqueConstraints = {@UniqueConstraint(columnNames={"aaa", "bbb", "ccc"})})


Cheers!


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

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.