Chapter 7. Using Hibernate with JBoss Data Virtualization
7.1. Configure Hibernate for Use with JBoss Data Virtualization
Prerequisites
- You must have the JBoss Data Virtualization JDBC API client JAR file (
teiid-client.jar) and the JBoss Data Virtualization hibernate dialect JAR file (teiid-hibernate-dialect-VERSION.jar) in Hibernate's classpath. These files are found inEAP_HOME/modules/system/layers/dv/org/jboss/teiid/client/main/.These are required for theorg.teiid.dialect.TeiidDialect,org.teiid.jdbc.TeiidDriverandorg.teiid.jdbc.TeiidDataSourceclasses.
Procedure 7.1. Configure Hibernate for Use with JBoss Data Virtualization
Open the Hibernate configuration file
Open thehibernate.cfg.xmlfile.Specify the JBoss Data Virtualization driver class
Specify the JBoss Data Virtualization driver class in theconnection.driver_classproperty:<property name="connection.driver_class"> org.teiid.jdbc.TeiidDriver </property>
Set the Connection URL
Specify the URL for the VDB in theconnection.urlproperty:<property name="connection.url"> jdbc:teiid:VDB-NAME@mm://HOST:POST;user=USERNAME;password=PASSWORD </property>
Note
Be sure to use a local connection if Hibernate is in the same VM as the application server. .Specify the dialect class
Specify the JBoss Data Virtualization dialect class in thedialectproperty:<property name="dialect"> org.teiid.dialect.TeiidDialect </property>
Note
hibernate.properties file instead of hibernate.cfg.xml:
hibernate.connection.driver_class=org.teiid.jdbc.TeiidDriver hibernate.connection.url=jdbc:teiid:VDB-NAME@mm://HOST:PORT hibernate.connection.username=USERNAME hibernate.connection.password=PASSWORD hibernate.dialect=org.teiid.dialect.TeiidDialect
Note
<class name="CLASSNAME" table="SOURCE/VIEW_MODEL_NAME.[SCHEMA_NAME.]TABLENAME"> ... </class>
<class name="org.teiid.example.Publisher" table="BOOKS.BOOKS.PUBLISHERS"> ... </class>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.