For performance reasons, I need to use some native queries to insert new objects into the database. I have a very complicated JPA persistence level that governs my normal reading and writing of entities, and I would like to use this persistence level to run my own queries.
I know that to achieve my goal I need the methods EntityManager # createNativeQuery (String) and Query # executeUpdate.
My current problem is that I would also like to get the generated id of the newly inserted row. I know this is possible using JDBC or SpringPersistence, but is there a way to get these identifiers from my own JPA request?
source share