-->
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.  [ 2 posts ] 
Author Message
 Post subject: Sequence Generated Custom ID Class
PostPosted: Mon Apr 25, 2005 7:23 pm 
Newbie

Joined: Tue Apr 19, 2005 3:58 pm
Posts: 1
Hibernate version:2

Is it possible to create a custom ID class with a sequence generator. I would like to use a sequence to generate long (number) ids but I want the result to be stored in my own custom ID class not the standard java Long class.

The Hibernate mapping would look something like this

<hibernate-mapping>
<class name="IDTester" table="ID_TESTER">
<id name="id" type="MyID" column="ID">
<generator class="MySequenceGenerator">
<param name="sequence">UNIQUE_IDS_TEST</param>
</generator>
</id>
<property name="value" type="string" column="VALUE" length="255"/>
</class>
</hibernate-mapping>

The problem with this mapping is that it treats MyID as a binary type and tries to insert it as such into ID_TESTE.ID which is defined as a number.

Is something like this possible?

Thanks
-Sam


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 12:03 pm 
Newbie

Joined: Wed Jun 15, 2005 8:00 am
Posts: 16
Location: Munich, Germany
check out http://forum.hibernate.org/viewtopic.php?t=929341


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.