bella_Hiber wrote:
It works, and I do a sequence insert for the id, but wonder why still the log is like this:
Hibernate: select nextval ('t_external_data_hotel_id_seq')
Hibernate: insert into public.t_external_data_hotel (first_name, surname, mobile_number, id) values (?, ?, ?, ?)
and not with the real values, and without the id column?
:)
There is an ID field in the statement. Which is a PreparedStatement, so you only see ? where Hibernate fills in the correct values.
First it selects the next value for your ID. Then it creates an insert statement with the parameters you have to set via yourObject.setXyz() and the ID retrieved just before. Hibernate doesn't do anything you could not do by using plain JDBC, but it makes things a lot easier. You don't have to care about creating SQL-Statements an spell all the fields right and use the correct SQL-Function for e.g. datefields.