Jpa entity generator assigns Integer type to the id fields of my entities. The corresponding attribute/column in my DB is of type serial ( yep postgres
). I would also assign the integer type to my entities id fields. But i have seen usage of Long getId()
on this page. I have also seen this type of type assigning on the geomajas examples. Is there any gotcha when it comes to using Integer
? I mean, yeah you have to be careful with integer that the id is not below 0 but at the same time you also have to make sure that your Long Id is not bigger than 2,147,483,647. So what's deal here?
EDIT: I was making a confusion between Long
and unsigned integer so i guess what i was thinking was "unsigned integer versus Integer
for the id field of java entities" which is nonsense now that my confusion between long and unsigned integer is gone. My bad. Thank you for your answers and comments. I guess if i would have used bigserial jpa entity generator would have used Long too.