Posts Tagged “Oracle”

I ran into a “gotcha” with Hibernate this past week.

I was working with an Oracle database where there are tables with synthetic (aka surrogate) keys that get their values from sequences — a fairly common thing, and a situation that Hibernate normally handles well with identity generator class of “sequence” or “native”.

But in this case, the Oracle database was using a before-insert trigger to get nextval from the sequence and stuff it into the primary key field before inserting the row into the table. The rationale for this was to ensure consistent management of the sequence for other code than the Hibernate/Java system that might hit the database.
Read the rest of this entry »

Comments No Comments »