• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database access error: Unable to obtain an object lock on "null [java.lang.String]"

 
Thirumani Selvam Muthuswamy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting "Database access error: Unable to obtain an object lock on "null [java.lang.String]" error

i have a entity class with many to one with fetchtype Lazy "@ManyToOne(fetch= FetchType.LAZY)"

eg: entity1
{
string element1,
string element2,
@ManyToOne(fetch= FetchType.LAZY)
public Entity2 ent2,
}
note : element 2 is "namedNativeQuery" i have created getters for all the element in enitiy2
when i try to invoke this entity1 using entityManager.createQuery, i am getting this error

<openjpa-2.4.0-nonfinal-1598334-r422266:1599166 fatal store error> org.apache.openjpa.persistence.OptimisticLockException: Unable to obtain an object lock on "null [java.lang.String]".
FailedObject: null [java.lang.String]
at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4980)
at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4958)
at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:134)
at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:84)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:311)
at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1050)
at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:1008)
at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:930)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.find(JDBCStoreManager.java:1002)
at org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.load(RelationFieldStrategy.java:793)
at org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:934)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:681)
at org.apache.openjpa.kernel.DelegatingStoreManager.load(DelegatingStoreManager.java:117)
at org.apache.openjpa.kernel.ROPStoreManager.load(ROPStoreManager.java:78)
at org.apache.openjpa.kernel.StateManagerImpl.loadFields(StateManagerImpl.java:3146)
at org.apache.openjpa.kernel.StateManagerImpl.loadField(StateManagerImpl.java:3226)
at org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(StateManagerImpl.java:1691)
at org.apache.openjpa.kernel.StateManagerImpl.accessingField(StateManagerImpl.java:1624)
at com.test.fa.app.test1.entities.Entity1.pcGetentity2(entity1.java)
at com.test.fa.app.test1.entities.Entity1.getEntity2(entity1.java:160)
at com.test.fa.app.test1.xao.XaoImpl.buildPatListXaoFromPO(SiteXaoImpl.java:38)
at com.test.fa.app.test1.dao.DAOImpl.getpatientList(UpdateDAOImpl.java:89)
at com.test.fa.app.test1.service.UpdateService.patientList(UpdateService.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)

Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: ORA-00942: table or view does not exist
{prepstmnt 195493853 SELECT t0.ENV_ID, t0.GRP_NUMBER, t0.NAME, t0.PRJ_ID FROM Entity2 t0 WHERE t0.GRP_ID = ?} [code=942, state=42000]
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:219)
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:203)
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:59)
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:1118)
at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:268)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1801)
at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:258)
at org.apache.openjpa.jdbc.sql.SelectImpl.executeQuery(SelectImpl.java:501)
at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:426)
at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:384)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getInitializeStateResult(JDBCStoreManager.java:549)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:351)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:306)
... 88 more
NestedThrowables:
java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:208)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:886)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1175)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1296)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3613)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3657)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1495)
at com.as.jdbc.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:177)
at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:270)
at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:1116)
at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:268)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1801)
at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:258)
at org.apache.openjpa.jdbc.sql.SelectImpl.executeQuery(SelectImpl.java:501)
at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:426)
at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:384)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getInitializeStateResult(JDBCStoreManager.java:549)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:351)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:306)
at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1050)
at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:1008)
at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:930)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.find(JDBCStoreManager.java:1002)
at org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.load(RelationFieldStrategy.java:793)
at org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:934)
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:681)
at org.apache.openjpa.kernel.DelegatingStoreManager.load(DelegatingStoreManager.java:117)
at org.apache.openjpa.kernel.ROPStoreManager.load(ROPStoreManager.java:78)
at org.apache.openjpa.kernel.StateManagerImpl.loadFields(StateManagerImpl.java:3146)
at org.apache.openjpa.kernel.StateManagerImpl.loadField(StateManagerImpl.java:3226)
at org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(StateManagerImpl.java:1691)
at org.apache.openjpa.kernel.StateManagerImpl.accessingField(StateManagerImpl.java:1624)
at com.test.fa.app.test2.entities.Entity1.pcGetentity2(Entity1.java)
at com.test.fa.app.test2.entities.Entity1.getEntity2(Entity1.java:160)
at com.test.fa.app.test2.xao.XaoImpl.XaoFromPO(SiteXaoImpl.java:38)
at com.test.fa.app.test2.dao.PatientSiteUpdateDAOImpl.getpatientList(PatientSiteUpdateDAOImpl.java:89)
at com.test.fa.app.test2.service.UpdateService.testList(UpdateService.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:227)
at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:194)
at org.apache.openejb.util.proxy.ProxyEJB$Handler.invoke(ProxyEJB.java:74)
at com.iconplc.fa.app.siteadmin.service.PatientSiteUpdateService$$LocalBeanProxy.patientList(com/iconplc/fa/app/siteadmin/service/PatientSiteUpdateService.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this part of the stack trace should give a clear indication about what's wrong
ORA-00942: table or view does not exist
{prepstmnt 195493853 SELECT t0.ENV_ID, t0.GRP_NUMBER, t0.NAME, t0.PRJ_ID FROM Entity2 t0 WHERE t0.GRP_ID = ?} [code=942, state=42000]
 
Thirumani Selvam Muthuswamy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:I think this part of the stack trace should give a clear indication about what's wrong
ORA-00942: table or view does not exist

{prepstmnt 195493853 SELECT t0.ENV_ID, t0.GRP_NUMBER, t0.NAME, t0.PRJ_ID FROM Entity2 t0 WHERE t0.GRP_ID = ?} [code=942, state=42000]


what is wrong in that




it is working fine, when i try with parameter.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thirumani Selvam Muthuswamy wrote:what is wrong in that

If the error message mentions that a table or view does not exist, you are using a table or view in your query that does not exist in your database. That should be pretty obvious!

Thirumani Selvam Muthuswamy wrote:it is working fine, when i try with parameter.

Both queries in your code snippet are different from the query in the stack trace.
 
Thirumani Selvam Muthuswamy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:
Thirumani Selvam Muthuswamy wrote:what is wrong in that

If the error message mentions that a table or view does not exist, you are using a table or view in your query that does not exist in your database. That should be pretty obvious!

Thirumani Selvam Muthuswamy wrote:it is working fine, when i try with parameter.

Both queries in your code snippet are different from the query in the stack trace.


Actually i am using below for entity 2




this is in relation with Enity1 as many to one
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still different queries from the one in the stack trace you have posted...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic