• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 70
  • Last Modified:

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

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?
0
DebeG
Asked:
DebeG
1 Solution
 
Gary PattersonVP Technology / Senior Consultant Commented:
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.
0
 
DebeGProgrammerAuthor Commented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now