7 Replies Latest reply on Nov 7, 2012 2:53 PM by Ramesh Reddy

    Using Hibernate (JPA) with Teiid

    Samaresh Sridhar Newbie

      Is there a tutorial that shows how to configure hibernate JPA with Teiid ?

        • 1. Re: Using Hibernate (JPA) with Teiid
          Samaresh Sridhar Newbie

          I have created a dynamic vdb having connection to two rdbms. My vdb has been deployed successfully on Jboss too. I am using netbeans to create the hibernate mapping. Is there any tutorial that help me configure the mapping for teiid ?

          • 2. Re: Using Hibernate (JPA) with Teiid
            Ramesh Reddy Master

            It is no different from any other RDBMS, once you have your VDB deployed then use Teiid Hibernate Dialect and Teiid JDBC driver to configure the hibernate mapping. That is all it takes.


            See https://docs.jboss.org/author/display/TEIID/Using+Teiid+with+Hibernate



            • 3. Re: Using Hibernate (JPA) with Teiid
              Samaresh Sridhar Newbie

              Hi..Sorry for the late reply...


              I have imported

              in my project


              I have these files in my project :





              The hibernate.cfg.xml has the following properties...


              <property name="hibernate.connection.driver_class">org.teiid.jdbc.TeiidDriver</property>

                  <property name="hibernate.connection.url">jdbc:teiid:Multidb@mm://localhost:31000</property>

                  <property name="hibernate.connection.username">user2</property>

                  <property name="hibernate.connection.password">user2</property>

                  <property name="hibernate.dialect">org.teiid.dialect.TeiidDialect</property>

                  <property name="hibernate.show_sql">true</property>

                  <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>

              and a few mapping resource elements


              The virtual database 'Multidb' has been deployed successfully.


              I have a Java swing client that just needs to access a table :


              I have the following methods in it:



              private static String query = "from autoChartingInfo";


              private  void runQuery(){




              private void executeHQLQuery(String hql){


                   try {

                      Session session = HibernateUtil.getSessionFactory().openSession();


                      Query q = session.createQuery(hql);

                      List resultList = q.list();

                      int length = resultList.size(); 




                   catch (HibernateException he) {





                  private void displayResult(List resultList) {

                  Vector<String> tableHeaders = new Vector<String>();

                  Vector tableData = new Vector();





              for(Object o : resultList) {

                      jbmUserId jbm = (jbmUserId)o;

                      jbmUser j = (jbmUser)o;

                      Vector<Object> oneRow = new Vector<Object>();











                  jTable1.setModel(new DefaultTableModel(tableData, tableHeaders));




              I am able to retrieve the number of rows of the table but all data being retrieved is 'null'


              Do I need to deploy the hibernate.jar in jboss after building it ?


              I don't know what I'm doing wrong

              • 4. Re: Using Hibernate (JPA) with Teiid
                Ramesh Reddy Master

                Try using more latest 8.2 Teiid, 7.0 is way old to think about.

                • 5. Re: Using Hibernate (JPA) with Teiid
                  Samaresh Sridhar Newbie

                  I tried using teiid 8.1... I am not able to get the tables for mapping

                  • 6. Re: Using Hibernate (JPA) with Teiid
                    Samaresh Sridhar Newbie

                    where do i put the teiid-hibernate-dialect.jar ?

                    • 7. Re: Using Hibernate (JPA) with Teiid
                      Ramesh Reddy Master

                      In your applications's classpath.