Questo contenuto non è disponibile nella lingua selezionata.
Chapter 6. Hibernate on JBoss Web Server
Hibernate is an object-relational mapping framework. It is packaged independently from Red Hat JBoss Web Server. This packaged version is used on all supported platforms.
Hibernate is used in the same way it is used for a regular Tomcat installation: the Hibernate JAR files are added into a deployment WAR file. Tomcat provides a default connection pooling mechanism, which is defined in
context.xml
. However, persistence.xml
and web.xml
are also required. The example below shows a configuration with the Tomcat connection pooling mechanism.
/META-INF/context.xml
defines the connection pools Tomcat should create.Example 6.1.
context.xml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow /WEB-INF/classes/META-INF/persistence.xml
is a JPA configuration file. It defines how the application configures Hibernate to consume connections from the Tomcat pool. If you are using the Hibernate API directly, use a similar configuration to that shown inhibernate.cfg.xml
.Example 6.2.
persistence.xml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow /WEB-INF/web.xml
is a regular web application deployment file, which instructs Tomcat which datasource to consume. In the example below, the datasource isjdbc/DsWebAppDB
.Example 6.3.
web.xml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
For details, see the Hibernate documentation for JBoss Web Server.