Entitymanager Object Management

Source: Internet
Author: User

Depending on how the Entitymanager object is managed, there are two types of these:

-Container-managed (container-managed) Entitymanager objects

Container-managed Entitymanager objects are the simplest, and programmers do not need to consider the release of Entitymanager connections, as well as complex issues such as transactions, all of which are given to the container to manage. Container-managed Entitymanager objects must run in the EJB container, not in the Web container and the J2SE environment. If Entitymanager objects are obtained by injecting @PersistenceContext annotations, this way of getting Entitymanager objects is managed by the container.

-Apply Managed (application-managed) Entitymanager objects

By applying managed Entitymanager objects, programmers need to manually control their release and connection, manually control transactions, and so on. However, this approach to the application of managed Entitymanager objects can be applied not only in the EJB container, but also from the EJB container and into any Java environment, such as the Web container, the J2SE environment, and so on. So in some ways, this is the basis for JPA to run independently of the EJB environment.

Entitymanager Object Management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.