we are currently confronted with the following scenario:
A legacy database schema has a special table that holds Table-names and associated IDs.
This table's data differs from one database instance to the other.
In order to write data to any other table of the database, this table's ID is needed -> look-up in the ID-table.
To reflect this behavior in a JPA-mapped environment, we wanted each entity to look up its ID in the ID-table before persisting.
But therefore we'd need a reference to an EntityManager from within an Entity.
Our solution: make it possible to inject an EntityManager into an Entity.