Hi,
I am using Hibernate's JPA implementation in a J2SE application. I am using an application-managed EntityManager and an EXTENDED persistence context. I chose to set the flush mode on the EntityManager to COMMIT. I am also using a resource-local transaction returned by the EntityManager.
During the transaction, I persist some newly created entities. But when I use native queries to search for these newly created entities, I get nothing back.
Correct me if I am wrong, but once an entity is persisted, any query (native or not) through the EntityManager should first examine the persistence context and then the database. If so, why isn't this the case for my example. For the record, I am using SELECT statements to look up the newly created entities and the look-ups are not based on the primary keys.
Any help would be appreciated.
|