-->
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: choose an id type for the primary key
PostPosted: Wed Jul 01, 2009 8:22 am 
Beginner
Beginner

Joined: Wed Jul 01, 2009 8:11 am
Posts: 34
hi,

i'm writing a framework and that has some domain-objects. because i'm unexpierenced in respect to hibernate, i don't know about the right choice when picking an id-type (Long? Integer? String? ...). so i decided to leave this choice to the framework user by supplying the id-type as an generic parameter for every domain class. now i'm wondering, if this is worth it's effort. what are the criterias when chosing an id-type? maybe it's appropriate when i already decide on the id-type in the framework!?

maybe Long is always the best choice?

regards, garz


Top
 Profile  
 
 Post subject: Re: choose an id type for the primary key
PostPosted: Thu Jul 02, 2009 11:41 am 
Beginner
Beginner

Joined: Wed Jul 01, 2009 8:11 am
Posts: 34
hmmmm


Last edited by garz on Wed Jul 08, 2009 10:23 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: choose an id type for the primary key
PostPosted: Wed Jul 08, 2009 9:40 am 
Beginner
Beginner

Joined: Wed Jul 01, 2009 8:11 am
Posts: 34
i now got my hands on the book "Hibernate in Action" and i read the part named "Understanding object identity". There they tell me, that Long has been chosen to match the type of identity value produced by native identifier generator. Sounds like i can safely assume that Long is always the best choice when using hibernate (for a new project, no legacy involved, no need to make compromise)? It would be awesome if someone could just give me that nice feeling of beeing sure. In addition i dont want to hook the framework to hibernate. So maybe therefor its better to make the identity type generic?

Does really nobody knows an answer to my question? I thought this kind of stuff is basic and had been dealt with many times before. I justed want an expierenced opinion because i really dont know, even after studying 4 (!!!) hibernate books + the reference guide + search in the forums and google, which is kind of useless when searching for "hibernate id choose", because of to many hits.

regards, garz


Top
 Profile  
 
 Post subject: Re: choose an id type for the primary key
PostPosted: Wed Jul 15, 2009 3:40 pm 
Beginner
Beginner

Joined: Wed Jul 01, 2009 8:11 am
Posts: 34
now that there is this new credit system i'm encouraged to try it again. :) and i will give credit, prolly for every answer i get, because i never got any answer till now. :) i'm just happy if i wasnt ignored.


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.