exception - Hibernate: org.hibernate.TransactionException. -


the issue following function is

it throws transactionexception if no users in database, when rollback transaction in catch block.

if remove rollbackstatement throws datanotfoundexception expected.

public list<t> findall() {     list<t> entitylist= null;     transaction tr = sessionutil.getsession().gettransaction();     try {           tr.begin();           entitylist= sessionutil.getsession()                      .createquery("from "+type.getsimplename()).list();           tr.commit();          if(entitylist.isempty())             throw new datanotfoundexception("404", "no "+type.getsimplename()+"'s present ");          } catch ( runtimeexception e) {        // tr.rollback();         throw new evaluateexception(e);     }      return entitylist; } 

please help. thank you


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -