Este contenido no está disponible en el idioma seleccionado.
Chapter 6. Hibernate on JBoss Web Server
Hibernate is an object-relational mapping framework. It is provided by the JBoss Web Server Maven Repository (jboss-web-server-5.0.0-maven-repository.zip). 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.xmldefines the connection pools Tomcat should create.context.xml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow /WEB-INF/classes/META-INF/persistence.xmlis 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.persistence.xml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow /WEB-INF/web.xmlis a regular web application deployment file, which instructs Tomcat which datasource to consume. In the example below, the datasource isjdbc/DsWebAppDB.web.xml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
For details, see the Hibernate documentation for JBoss Web Server.