In Oracle terminology: I need to get a sequence value from the database beforehand, en use it later at insert time (then the sequence-insert-trigger in the database is not used because I specify the previously fetched serial value)
Shouldn't this be possible with hibernate as well?
I did find some code that looks like what I want:
Code:
ClassPersister classPersister = ((SessionFactoryImplementor) sessionFactory).getPersister(Person.class);
Person person = new Person();
IdentifierGenerator idGenerator = classPersister.getIdentifierGenerator();
Serializable id = idGenerator.generate((SessionImplementor) session, person);
But, I just want the serial value for later use, I don't want to instantiate a POJO right away, (as in this exmaple)
thanks,
Ben