How to still read a locked iseries file using Hibernate in Java

DebeG used Ask the Experts™
Using Hibernate to create a list of data from an iseries file.  I dont want to update this file, just want to retrieve data.  If the file is already open on iseries, my java code pauses at this statement (List list = loggedQuery.list();)  until the lock on the file is gone.  Is there a way to still read this file, even if it has a  *SHRRD lock?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
VP Technology / Senior Consultant
What isolation level are you using?  Sounds like SERIALIZABLE, which requires and exclusive lock.
Try READ UMCOMMITTED.  You should just get a shared read lock that way.


Ok, it is set as follows in our  hibernate.cfg file, with a strong note to not change it.
<property name="hibernate.connection.isolation">2</property>  

So,  realized that I can add  objSession.connection().setTransactionIsolation(0); on query of the read only file.  This worked.  Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial