此内容没有您所选择的语言版本。

Chapter 7. Using Hibernate 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 in EAP_HOME/modules/system/layers/dv/org/jboss/teiid/client/main/.
    These are required for the org.teiid.dialect.TeiidDialect, org.teiid.jdbc.TeiidDriver and org.teiid.jdbc.TeiidDataSource classes.

Procedure 7.1. Configure Hibernate for Use with JBoss Data Virtualization

  1. Open the Hibernate configuration file

    Open the hibernate.cfg.xml file.
  2. Specify the JBoss Data Virtualization driver class

    Specify the JBoss Data Virtualization driver class in the connection.driver_class property:
    <property name="connection.driver_class">
       org.teiid.jdbc.TeiidDriver
    </property>
    Copy to Clipboard Toggle word wrap
  3. Set the Connection URL

    Specify the URL for the VDB in the connection.url property:
    <property name="connection.url">
       jdbc:teiid:VDB-NAME@mm://HOST:POST;user=USERNAME;password=PASSWORD
    </property>
    Copy to Clipboard Toggle word wrap

    Note

    Be sure to use a local connection if Hibernate is in the same VM as the application server. .
  4. Specify the dialect class

    Specify the JBoss Data Virtualization dialect class in the dialect property:
    <property name="dialect">
       org.teiid.dialect.TeiidDialect
    </property>
    Copy to Clipboard Toggle word wrap

Note

Alternatively, the connection properties can be added to the 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
Copy to Clipboard Toggle word wrap

Note

Since your VDBs will likely contain multiple source and view models with identical table names, you will need to fully qualify table names specified in Hibernate mapping files:
<class name="CLASSNAME" table="SOURCE/VIEW_MODEL_NAME.[SCHEMA_NAME.]TABLENAME">
   ...
</class>
Copy to Clipboard Toggle word wrap
For example:
<class name="org.teiid.example.Publisher" table="BOOKS.BOOKS.PUBLISHERS">
   ...
</class>
Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat