How does JPA work?

How does JPA work if you use this in your project? And how does it handle the response when a 1000 request arrives for the same data access at a time?

+3
source share
1 answer

JPA is basically an abstraction using ORM methods. If you map various model classes to a database, JPA can: a) generate the appropriate SQL query / update, b) convert the resulting groups to model classes. JPA also includes caching and abstract transaction processing.

In the end, it does nothing magical - it all ends up passing through your JDBC driver, becoming raw SQL and returning results for JDBC, etc. It just allows you to hide a lot of code and just work with your model classes like regular Java objects (POJOs), where setting a property starts UPDATE and getting a property starts SELECT (caching everything and the organization in a transaction provides much better performance than you could get through simple one-to-one implementation.

So your second question makes no real sense - if 1000 queries come out, it is mainly a DATABASE database server that should scale and process this, not JPA. (Admittedly, he should deal with sending them and then sort them into java objects)

+7
source

All Articles