Sometimes if you want to assign the id an not let the DB do it for you it is
good to be able to have null values. Also checkin whether the object is
already saved can be achieved by just checking id != null.

Primitive int defaults to zero without initialization?

 - Ville


Ulrich Stärk wrote:
> 
> Thiago H. de Paula Figueiredo schrieb:
>> Em Mon, 09 Feb 2009 22:35:52 -0300, Luther Baker <[email protected]> 
>> escreveu:
>> 
>>> Simply stated, I'm asking about the two orthogonal choices: (native vs
>>> object, range or size)
>>> Is an int preferred to an Integer? Is there a compelling argument for 
>>> either native or Object?
>> 
>> I guess that you mean "primite" when you mean "native".
>> Native types in Java can't have null values, so, for primary key 
>> properties, a Integer is a much better fit than an int.
> 
> Why is that? I couldn't imagine a case where you want your primary key 
> value to be NULL (apart from the fact that I don't know any DBMS that 
> allows that).
> 
> Uli
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Hibernate-ID-tp21926024p21930330.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to