We have a hard situation.
- There is a large project which uses hibernate special features so cannot quit hibernate.
- We are to add Activiti process engine to the project in embedded mode and make use of JPA extensions (which only works with EntityManager)
- Some entities should not be present in JPA persistent unit because as activiti documentation says all entities must have @Id and cannot use @IdClass/@EmbeddedId so we have to exclude such entities from persistent unit
- We wish to use one shared transaction manager for EntityManager and Session. Also the dataSources are identical (or even shared)
- Everything is Spring!
All this effort is to enable Activiti to use EntityManager for its JPA extension while letting existing hibernate dependent codes to continue work.