Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Anchor
top
top

This article will help you migrate applications using Hibernate 3.2 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 org.hibernate.jmx.HibernateService which can be deployed on JBoss.

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
JTA transaction. This means you no longer have to manually open and close the Session, this becomes the job of a JBoss EJB interceptor.

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.

...

  1. 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>
  2. 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>
  3. Start the new server by running the run.sh -c <your_server_name> command from the <jboss_home>\bin directory.
  4. 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.
  5. 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
bgColor#FFFFFF
borderStylesolid
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

...