0 Replies Latest reply on Nov 7, 2013 4:08 PM by balaji.sengeni

    table inheritance - postgresql & Hibernate

    balaji.sengeni

      Hi all,

       

      Is any one used table inheritance in database with hibernate via JPA? If so, can you suggest for below use case

        I have to update entity on parent table, for which I have to use 'only' keyword before table name (select, update, delete,.. but not for insert, rename...).

        Is it possible to append 'only' keyword when updated via merge/update/save operation using DAO?

       

      e.g., 

               Employee emp = empolyeeDao.findOne(1);

               emp.setName('Tom');

               empolyeeDao.update(emp);

                ....

       

      and update is defined in generic DAO as :

       

          public T update( final T entity ){

              return this.entityManager.merge( entity );

          }

       

      Here hibernate will generate update query without 'only' e.g., : update employee set name ='Tom', title='Mr' where id=1; but I need it to be update only employee set name ='Tom', title='Mr' where id=1;

      using DAO. Is it possible?

       

      Reference for Table inheritance:  http://www.postgresql.org/docs/9.0/static/ddl-inherit.html

       

      Regards,

      Balaji