[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.eclipselink] Re: Negative Ids

HI James,
thank you.
I will vote for that logged bug.

I could use Integer id
instead of int. The problem is that I use persistence also for my JSP page....I
need to make persistent value set by user in form on jsp page. I use java bean
and they work with primitive types (int, ..string,...array of primitives...).
If I use Integer, I need always make control to cast int type to integer (into
get methods).
I prefer they solve the bug :-)


Enrico

James ha scritto:
I think there is a bug logged about negative ids, you could search for and vote for it.

You would be best using an Integer id instead of int, the issue is that the generator needs to know if to generate a new id or not, normally this is done for null, but for int there is not null,
so 0 is assumed to be uninitialized, some people also use -1 or negative numbers for uninitialized, so these are assumed to mean null as well, as the generator will never generate a negative number.