Anchor | ||||
---|---|---|---|---|
|
This article will help you migrate applications using Hibernate 34.2 1 as the ORM tool from JBoss Application Server 47.2.1 0 to Apache Geronimo 23.0.
Hibernate is a powerful, high performance object/relational persistence and query service. It helps in the development of persistent (POJO) classes which have the getter and setter methods for attributes that are then mapped to fields in the database. You may follow object-oriented idiom - including association, inheritance, polymorphism, composition, and collections. Hibernate allows you to express queries in its own portable SQL extension (HQL), as well as in native SQL, or with an object-oriented Criteria and Example API.
Basically, Hibernate maps the Java classes to the database tables. It also provides the data query and retrieval facilities that significantly reduce the development time. It fits in naturally to the object-oriented mode of code development in the JAVA middle-tier. A unique feature of Hibernate is that it facilitates transparent persistence that enables the applications to switch to any database be it MySQL, Oracle or DB2. Hibernate can be used in Java Swing applications, Java Servlet-based applications, or J2EE Java EE applications using EJB session beans (Java Servlet based application in our case).
...
These properties are common to any application server including Apache Geronimo v2v3.0.
However, JBoss (more specifically the Hibernate MBean) provides two additional deployment mechanisms.
...
The following table provides a feature-to-feature comparison between these two applicaiton servers.
Feature | Apache Geronimo v2v3.0 | JBoss v4v7.2.1 0 |
---|---|---|
Container-managed datasource | Supported. Hibernate is able to use a datasource given its JNDI name. This is because it is running in the same thread as the application. | Supported. Hibernate can lookup a datasource from JNDI given its JNDI name. |
Automatic JNDI binding | Not Supported. | Supported. Once the property is set the session factory is bound to the JNDI context. |
JTA Session binding | This feature is not supported out of the box. We need to write a lookup for the Geronimo Transaction Manager to enable this. | Supported out of the Box. Hibernate provides a lookup class for the JBoss Transaction Manager. |
JMX deployment | Not Supported out of the box. Can be implemented by writing a GBean and a Hibernate Connection Provider class. | Supported. Hibernate is distributed with |
Hibernate Archive (HAR) | Not Supported. Hibernate classes are deployed as a part of the J2EE archives. | Supported. A HAR packages the configuration and mapping files enabling extra server support to deployment. |
Caching | You can use caching mechanisms provided by hibernate. | You can use caching mechanisms provided by hibernate. Integration with JBoss Cache is also supported. |
Session Management | Not Supported. It is required to manually open sessions. Only the transaction needs to be closed. | The Hibernate Session's lifecycle can be automatically bound to the scope of a |
Hibernate Mapping Files | We need to specify the locations of the Hibernate mapping files. | If we use HAR deployment JBoss will automatically lookup the Hibernate mapping files. |
...
At the time of writing this article, Hibernate 34.2 1 is the latest version available and can be downloaded at the following URL:
http://www.hibernate.org
Additional documentation on Hibernate may be found at the following URL:
http://hibernate.org/5.html
http://www.hibernate.org/hib_docs/v3/reference/en/html/tutorial.html
Download and install Hibernate, the installation directory will be later referred as <hibernate_home>.
...
- Download and install JBoss v4v7.2.1 0 as explained in the product documentation guides. From now on the
installation directory will be referred as <jboss_home> - Create a copy of the default JBoss v4v7.2.1 0 application server. Copy recursively <jboss_home>\server\default to <jboss_home>\server\<your_server_name>
- Start the new server by running the
run.sh -c <your_server_name>
command from the <jboss_home>\bin directory. - Once the server is started, you can verify that it is running by opening a Web browser and pointing it to this URL: http://localhost:8080. You should see the JBoss Welcome window and be able to access the JBoss console.
- Once the application server is up and running, the next step is to install and configure all the remaining prerequisite software required by the sample application. This step is described in the following section.
...
No Format | ||||
---|---|---|---|---|
| ||||
C:\geronimo-23.0\bin>deploy --user system --password manager deploy \brokerage\plan\mysql-geronimo-plan.xml ..\repository\org\tranql\tranql-connector-ra\1.3\tranql-connector-ra-1.3.rar Deployed user/database-pool-HibernateDS/2.0/car |
...