Spring, Hibernate and WebLogic 12C integration
In this page I will present the configuration to integrate Spring, Hibernate and Weblogic 12C and give the reasons why this combination is good.
Spring:
Spring is a framework for building J2EE applications, its power resides in the simplicity and the flexibility in terms of development. Spring provides the best solutions for developing J2EE applications as it overcomes the problems encountered in other frameworks like EJB.
Hibernate:
Hibernate a very popular ORM (Object-Relational Mapping) framework, it
WebLogic Server 12C
Weblogic 12C is a full J2EE application server, used for deploying enterprise applications and supports high availability, clustering, workload, balancing and monitoring. Its architecture permits a very advanced environment configuration and control. It is the version that supports J2EE-6, all previous versions (10.3.x(6,5,,,) ) are J2EE-5 or lower. This version, 12C, supports JPA2 as a persistence layer among others supported one's like TOPLINK, and KODO that are default installed in the application server.
Configuration:
In this page I will present the configuration to integrate Spring, Hibernate and Weblogic 12C and give the reasons why this combination is good.
Spring:
Spring is a framework for building J2EE applications, its power resides in the simplicity and the flexibility in terms of development. Spring provides the best solutions for developing J2EE applications as it overcomes the problems encountered in other frameworks like EJB.
Hibernate:
Hibernate a very popular ORM (Object-Relational Mapping) framework, it
WebLogic Server 12C
Weblogic 12C is a full J2EE application server, used for deploying enterprise applications and supports high availability, clustering, workload, balancing and monitoring. Its architecture permits a very advanced environment configuration and control. It is the version that supports J2EE-6, all previous versions (10.3.x(6,5,,,) ) are J2EE-5 or lower. This version, 12C, supports JPA2 as a persistence layer among others supported one's like TOPLINK, and KODO that are default installed in the application server.
Configuration:
- Server configuration:
First, create a data source in the Weblogic server to your database with a name of your choice that must satisfy the notation used for jndi sources: preferably jndi/datadsource_name, I will use appsDataSource to name the datasource in the weblogic server.
The key file in the configuration is the web.xml, here is what you need to include in the file to get you datasource recognised:
<persistence-unit-ref><description>Persistence context for the inventory management application.</description><persistence-context-ref-name>persistence/appsDataSource</persistence-context-ref-name> <persistence-unit-name>appsPU <!-- Defined in persistenc.xml --></persistence-unit-name><persistence-unit-ref> - Persistence Layer.
add the following to the standard configuration, but dont forget to name your persistence unit appsPU
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction. WeblogicTransactionManagerLook up" /> <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal. WeblogicJtaPlatform" /> this enables JTA and informs the server that the persistence provider is Hibernate. - Spring Configuration.
for the beans.xml, do as follows:
<jee:jndi-lookup id="appsPU" jndi-name="persistence/appsDataSource"/>
Aucun commentaire:
Enregistrer un commentaire