Thank you Thiago.

-Luther



On Mon, Feb 9, 2009 at 8:53 PM, Thiago H. de Paula Figueiredo <
thiag...@gmail.com> wrote:

> Em Mon, 09 Feb 2009 22:35:52 -0300, Luther Baker <lutherba...@gmail.com>
> escreveu:
>
>  This is a little offtopic - so I apologize in advance but I'm building
>> Tapestry applications and have a Hibernate question that I'd like to pose
>> here.
>> Is there preferred type for simple Hibernate IDs?
>>
>
> I always use an artificial (i.e. a column that is used only as id, not
> being used to store real data) integer column generated by the DBMS as a
> table primary key. I always use Integer, unless I expect the number of rows
> to be huge. In that cases, I use Long.
>
> By the way, *never* use compound primary keys or any natural id column.
> That's my advice. It's simple, it's fast, it prevents some very bad problems
> when you need to change the database structure.
>
>  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.
>
>  Is an Integer preferred to a Long (if the extra range of the the Long is
>> unecessary)?
>>
>
> Yes.
>
>  For instance, using hsqldb - would a Long possibly require TWO columns and
>> an Integer only one?
>>
>
> No. A Long would require a 64 bits column type in the DBMS.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to