[
https://issues.apache.org/jira/browse/OPENJPA-1860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Hugh updated OPENJPA-1860:
--------------------------
Attachment: QueueData.java
ORM.xml
persistence.xml
Added persistence.xml and ORM.xml, both of which are in my jar files META-INF
directory. Also added the Entity class.
The rewritten orm.xml is in the same directory with the jar and is identical
except it has a valid table name.
If I change the code to use a Query with the exact jpaql statement instead of
NamedQuery, it works fine.
Stack trace:
run:
Exception in thread "main" <openjpa-2.0.1-r422266:989424 fatal general error>
org.apache.openjpa.persistence.PersistenceException: Invalid object name
'Dummy'. {prepstmnt 28814882 SELECT TOP 100 t0.ID, t0.Action, t0.Errors,
t0.EventDateTime, t0.LastStatusChange, t0.Message, t0.OrgCode, t0.Resent,
t0.SeqNumber, t0.Source, t0.Status, t0.TableName FROM Dummy t0 ORDER BY t0.ID
DESC} [code=208, state=S0002]
FailedObject: SELECT qd FROM QueueData qd ORDER BY qd.id DESC [java.lang.String]
at
org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4832)
at
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4792)
at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:136)
at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:118)
at
org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:70)
at
org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.handleCheckedException(SelectResultObjectProvider.java:155)
at
org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:40)
at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1246)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1005)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:861)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:792)
at
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:288)
at
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302)
at
com.agilityapplications.turret.DataQueue.getQueueData(DataQueue.java:57)
at com.agilityapplications.turret.DataQueue.logThem(DataQueue.java:158)
at com.agilityapplications.turret.Main.<init>(Main.java:15)
at com.agilityapplications.turret.Main.main(Main.java:22)
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Invalid object
name 'Dummy'. {prepstmnt 28814882 SELECT TOP 100 t0.ID, t0.Action, t0.Errors,
t0.EventDateTime, t0.LastStatusChange, t0.Message, t0.OrgCode, t0.Resent,
t0.SeqNumber, t0.Source, t0.Status, t0.TableName FROM Dummy t0 ORDER BY t0.ID
DESC} [code=208, state=S0002]
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:273)
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:257)
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:70)
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:1079)
at
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:278)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1711)
at
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:268)
at
org.apache.openjpa.jdbc.sql.SelectImpl.executeQuery(SelectImpl.java:471)
at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:396)
at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:354)
at
org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(SelectResultObjectProvider.java:94)
at
org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:34)
... 11 more
NestedThrowables:
java.sql.SQLException: Invalid object name 'Dummy'.
at
net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
at
net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477)
at
net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:776)
at
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:280)
at
org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeQuery(LoggingConnectionDecorator.java:1077)
at
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:278)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeQuery(JDBCStoreManager.java:1711)
at
org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:268)
at
org.apache.openjpa.jdbc.sql.SelectImpl.executeQuery(SelectImpl.java:471)
at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:396)
at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:354)
at
org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(SelectResultObjectProvider.java:94)
at
org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:34)
at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1246)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1005)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:861)
at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:792)
at
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:288)
at
org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302)
at
com.agilityapplications.turret.DataQueue.getQueueData(DataQueue.java:57)
at com.agilityapplications.turret.DataQueue.logThem(DataQueue.java:158)
at com.agilityapplications.turret.Main.<init>(Main.java:15)
at com.agilityapplications.turret.Main.main(Main.java:22)
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)
> How do I get OpenJPA to use my custom classloader to load Entity classes?
> -------------------------------------------------------------------------
>
> Key: OPENJPA-1860
> URL: https://issues.apache.org/jira/browse/OPENJPA-1860
> Project: OpenJPA
> Issue Type: Question
> Components: jpa
> Affects Versions: 2.0.1
> Environment: OpenJPA 2.0.1 Java 1.6-22
> Reporter: Hugh
> Attachments: ORM.xml, persistence.xml, QueueData.java
>
>
> I have written a custom classloader and I can't work out how to get OpenJPA
> to use it to load my entity classes.
> I've followed instructions I found to set
> Thread.currentThread().setContextClassLoader() at startup before loading any
> EntityManager and it seems to load the OpenJPA classes and a lot of others,
> but not the class I'm interested in.
> Is this the right approach?
> If so, where have I gone wrong?
> (http://openjpa.208410.n2.nabble.com/Dynamic-Table-value-td5645906.html)
> If not, how should this be done?
> Is there some sort of guide to accomplishing this that someone could point me
> to?
> Thanks.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.