|
Hi Steve,
Are you using Spring Transaction or some other framework? If yes, please read on
I am assuming you have multiple schemas in the same datasource. I see two workarounds depending on your use case
(a) Can you use two EntityManager and JpaTransactionManager. Reference the transaction managers using the qualifier attribute in XML or equivalent in Javaconfig. Then annotate them accordingy and use them.
(b) Make use of PrePersist annotation. Create a native SQL (get next value from sequence, just like Hibernate will do but with your schema name hardocded or picked from a property) and populate the value in the id attribute. This defeats the purpose of ORM, but might be useful in your case.
Hope it helps
|