开发者

How does JPA actually works? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

How does JPA actually works if you are using this in your project?And How is it handle the response t开发者_如何学JAVAhe request when 1000 request come for the same data access at a time?


JPA is basically an abstraction, using ORM techniques. If you map various model classes to the database, then JPA can a) generate an appropriate SQL query/update, b) convert the resultsets to the model classes. JPA also includes caching, and abstracts transaction handling.

In the end it doesn't really do any thing magical - everything ends up going through your JDBC driver, becoming raw SQL and returning JDBC resultsets and such. It merely allows you to hide a lot of that code away and just work with your model classes as Plain Old Java Objects (POJOs) where setting a property triggers a UPDATE and getting a property triggers a SELECT (the caching of everything and organization into transactions allows far better performance than you would get through a simple one-to-one implementation.

So your 2nd question has no real meaning - if a 1000 requests go out, it's mostly the DATABASE SERVER that has to scale and handle this, not JPA. (Admittedly it has to deal with sending them out and then marshalling them into java objects)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜