简体   繁体   中英

native query and jpa

when using jpa native query
is transaction propagation the only feature of proper JPA we are using ?

I me in my opinio is just like using plain old jdbc pluc jpa transaction propagation

So there's no concept of persistence context ?

Can you validate my ideas , and point me to some me official docs about this ?

EDIT:

One thing to be careful of with SQL queries that return entities is that the resulting entity instances become managed by the persistence context, just like the results of a JP QL query.

I'm reading the book PRO JPA, and from what I understood
when we use jpa native query to get a set of scalar values (much the same way we do with jdbc) ther's really no concept of managed entities and persistence context. Things change of course when through native queries we retrieve Entities.

In my experience, there's a big difference in the time it takes to execute JPA native queries and JDBC queries. Probably due to the creation of the persistence context.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM