-->
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.  [ 6 posts ] 
Author Message
 Post subject: Primitives and Hibernate
PostPosted: Wed Mar 17, 2004 5:06 pm 
Newbie

Joined: Mon Feb 16, 2004 11:28 pm
Posts: 16
Ive been noticing that most people are using Long as opposed to long. Does hibernate not support primitives or are there shortcommings with using them?

Thanks in advance
jm


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 5:10 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
It's a bit akward to use as an identifier type (e.g. you have to call Session.load(new Long(longvalue)), also on other API methods), but I don't know a good reason why you shouldn't use them. It's really your choice for your domain classes.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 5:18 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
it's not because of null value?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 5:19 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Obviously :)

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 5:23 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
i said that because i've seen many beginners that didn't realised that primitives cannot have null value... ;)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 5:25 pm 
Newbie

Joined: Mon Feb 16, 2004 11:28 pm
Posts: 16
Gotcha, so the lack of a value in the database(NULL) results in a Long obj = null? That makes sense. If one were to use long, I guess it would default to 0 or something so the NULL state wouldn't be detected. Thanks again.

jm


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