I am injecting the EntityManager into my session beans as follows:
protected EntityManager em;
I could inject the factory if that will make things easier.
To access the underlying metamodel (Project -* Descriptor -* Mapping) you need to cast and un-wrap the native EntityManagerImpl. In container managed the container will provide its own wrapper so you will need to call getDelegate and cast the result.
The project has a map of descriptors keyed by entity class.
The only wrinkle in this is that getDelegate() will return null if you are not within a transaction.
|Free forum by Nabble||Edit this page|