This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I dont know why I am getting this. Because some times its working fine.
The following is my object and trying to save:
classes A, B, C are mapped with TABLE_A, TABLE_B, TABLE_C tables in database.
I am trying to save A as follows:
some times i am getting the following exception:
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not insert: [A]; uncategorized SQLException for SQL [insert into TABLE_B (.........) values (........)]; SQL state [HY000]; error code [-210016]; [DataDirect][OpenEdge JDBC Driver][OpenEdge] Lock table is full. (7870); nested exception is java.sql.SQLException: [DataDirect][OpenEdge JDBC Driver][OpenEdge] Lock table is full. (7870)
Each time you need to update an Object in the database you need to obtain a lock on the Row containing the data. This lock is held in a table named the 'Lock table' and this table has a limited number of rows, and so has a limited number of objects that can be updated in a single transaction. It appears like you are attempting to update too many objects in a single transaction (maybe because of the Set<B> and Set<C> are large collections.)
I think there are a couple of solutions:
1) You could examine your database configurations and see if there is an option to increase the number of rows in the lock table. For example, the Progress DB has -L. You would want to set that value to something larger than the total number of Objects you expect in a single transaction. If you don't know the number you expect then you could use a debugger to figure it out.
2) Reduce the size of your transaction. Examine the data which is being committed on a single transaction and see if you can either reduce the total number of Objects or break the transaction into multiple transactions (safely).
Joined: Apr 24, 2012
Thanks for help...
I am thinking Set<B> (if it contains huge data) needs to save separately as follows:
i have tried with above code but no use. After 7 thousand count or iterations its giving same SQL exception.
I have tried one more scenario:
This is working fine, i am able save data. good.
Here is my question: 1)What is difference between first and second scenario?
2) In second scenario if saveBlist() method throws an SQL exception, will the A save in database or all operations will rollback?