-->
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.  [ 5 posts ] 
Author Message
 Post subject: How to use my own type for table IDs?
PostPosted: Mon Dec 22, 2003 8:03 pm 
Newbie

Joined: Fri Nov 21, 2003 1:06 pm
Posts: 7
Location: Toronto, Canada
Hi,

I am trying to use my own type for IDs instead of long or String. My mapping looks like:

<id name="traceSummaryId" column="trace_summary_id" type="com.PersistentObjectId">

Of course, Hibernate complains that it cannot interpret this type.

Please tell me how I can create my own type for IDs. I tried implementing UserType to do it, but I am not sure how to implement nullSafeGet and nullSafeSet -- PersistentObjectId is really just a wrapper class for a long -- our architects want to see some fancy class names:):)

Thanks a lot
Alex


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 5:39 am 
Newbie

Joined: Mon Nov 10, 2003 10:37 am
Posts: 3
Location: Hungary
I think you want to use composite id:
http://www.hibernate.org/hib_docs/refer ... ping-s1-4b


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 23, 2003 3:10 pm 
Newbie

Joined: Fri Nov 21, 2003 1:06 pm
Posts: 7
Location: Toronto, Canada
sofi wrote:
I think you want to use composite id:
http://www.hibernate.org/hib_docs/refer ... ping-s1-4b


Actully, I do not want use a composite id -- my id is very simple it is just a long. But, I want to wrap a long in my own object -- PersistentObjectId so that it looks as if it is abstracted from the primitive data types.

Please advise
Thanks
Alex


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 24, 2003 3:54 am 
Regular
Regular

Joined: Tue Sep 02, 2003 5:09 pm
Posts: 81
Location: Whitefish Montana
Something similar was brought up a couple of weeks ago:

http://forum.hibernate.org/viewtopic.php?t=926374


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 24, 2003 3:59 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Have a look at http://www.hibernate.org/Documentation/NonDefaultTimeZone, http://www.hibernate.org/hib_docs/reference/html_single/#or-mapping-s2-4
and net.sf.hibernate.test.DoubleStringType

_________________
Emmanuel


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