I understand that an IdentifierGenerator is necessary for normal Hibernate usage. It makes sense that Hibernate would need to know the ID to maintain the persistence context. However, why is a generator necessary for a stateless session?
My problem is that I'd like to use the Identity generation strategy in most places. I use MySQL and that is the simplest and most natural strategy. I have one section where I need to do a large number of inserts. The only way currently to get optimal performance is to change the generation strategy.
If I'm using a StatelessSession, why would Hibernate require the ID of the entity? Why can't it just insert the entity and not retrieve the ID? Is there a flag I can use or some special way to create a session or transaction to say that I don't care about identifier tracking for this operation?
|