Managed Versus Non-Managed Environments
This Hibernate tutorial is to understand the difference between having a managed vs non-management environments. Configuring Hibernate requires us to determine the type of environment that Hibernate is going to function.
Managed and Non-managed are two different types of environments where Hibernate will fit in the architecture comfortably. Both these environments have their own advantage and disadvantages, it depends on the project business requirements and use case. Going through the Hibernate architecture will help to understand this better.
Managed Environment means that everything Hibernate needs will be handled by the environment itself; transaction and connection pooling are two important things Hibernate will require any compliant JEE server to provide.
- Managed environments are also called container environment, they are widely defined in a Java EE containers. Through using of managed environments, multiple awareness are covered, even the transactions.
- If we use hibernate within a container managed environment, then no need to depend on Hibernate connection pool implementation, because the connection pool for the server can be used.
Non-Managed Environment needs us to add some additional efforts by providing Hibernate with all what it needs. Following this tutorial we will see with an example to explain how to can configure Hibernate Framework in a Non-Managed Environments, so no JEE container is required and even no need for Apache Tomcat as well.
- Non-managed environment requires us to handle our transactions manually, as we would be seeing. Begin a transaction and commit of it is our responsibility.
- Hibernate has integrated fluently with the C3P0 connection pool implementation. Even hibernate provides us the ability to use another implementation, but still we can rely on hibernate handling all of these excellently.
This Hibernate tutorial was added on 24/09/2014.