Eric Lefevre-Ardant on Java & Agile

February 15, 2007

Hibernate: so, the identifier field *is* mandatory after all!

Filed under: hibernate, java — Eric Lefevre-Ardant @ 12:40 pm

Is it obvious to everyone that an identifier is mandatory in Hibernate? I actually thought that Hibernate generated some kind of internal identifier for classes that do not specify one.

The documentation says:

saveOrUpdate() does the following: [...] if the object has no identifier property, save() it

That strongly implies that you can have no identifier, right?

In the test that I have written recently, I wanted to keep things as simple as possible. Just a String column in a table.
(more…)

Powered by WordPress