Hibernate version: 2.1.6
How can I access the EntityPersister for a persistent instance?
I can get the ClassMetadata for the class via SessionFactory.getClassMetaData(Class) and cast the returned value to an AbstractEntityClass, but I don't like "casting on faith".
The ultimate objective is to get a handle on the IdentifierGenerator for the instance's persistent class. For this class, I want to sometimes assign IDs manually and sometimes have Hibernate assign IDs, and I'd like to use the same underlying mechanism (Oracle sequences).
Is there another good way to define and access Identifier Generators in Hibernate? For instance, it would be nice if I could map a sequence as a stand-alone Hibernate construct, as opposed to writing the JDBC to do it myself.
Thanks!
- nate
|