You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Marina Vatkina <Ma...@Sun.COM> on 2007/03/22 23:51:34 UTC
Problem running JPA example from GlassFish page on GF+OpenJPA+Derby
Hi,
I tried to run our simple JPA example that can be found under (src and all)
https://glassfish.dev.java.net/javaee5/persistence/persistence-example.html
adding OpenJPA as the provider provider, and 'drop and create' tables settings
to persistence.xml.
The test inserts a customer and 2 orders, then runs a JPQL query to verify the
insert, followed by delete and again verify.
The same example works correctly on Oracle. I used the snapshot downloaded
yesterday.
1. Derby had been identified correctly:
[#|2007-03-22T14:55:01.920-0700|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=20;_ThreadName=p:
thread-pool-1; w: 3;_RequestID=80f667e2-03ab-4ccd-bb17-b8b4d0a88698;|495041 pu1
INFO [p: thread-pool-1; w: 3] openjpa.jdbc.JDBC - OpenJPA will now connect
to the database to attempt to determine what type of database dictionary to use.
To prevent this connection in the future, set your openjpa.jdbc.DBDictionary
configuration property to the appropriate value for your database (see the
documentation for available values).
|#]
[#|2007-03-22T14:55:02.876-0700|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=20;_ThreadName=p:
thread-pool-1; w: 3;_RequestID=80f667e2-03ab-4ccd-bb17-b8b4d0a88698;|495997 pu1
INFO [p: thread-pool-1; w: 3] openjpa.jdbc.JDBC - Using dictionary class
"org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby 10.2.2.0 - (485682)
,Apache Derby Network Client JDBC Driver 10.2.2.0 - (485682)).
|#]
2. verifyInsert failed with:
Caused by: <4|true|0.9.7-incubating-SNAPSHOT>
org.apache.openjpa.persistence.ArgumentException: Could not locate metadata for
the class using alias "Customer". Registered alias mappings: "{Customer=null}"
at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:345)
at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:164)
at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:142)
at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:211)
at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateMetaData(JPQLExpressionBuilder.java:181)
at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandidateType(JPQLExpressionBuilder.java:174)
at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$500(JPQLExpressionBuilder.java:61)
at
org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.populate(JPQLExpressionBuilder.java:1668)
at org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:52)
at
org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCompilation(ExpressionStoreQuery.java:145)
at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:644)
at
org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:625)
at
org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:591)
at
org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:653)
at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1475)
at
org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:120)
at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:214)
at
org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:282)
at ejb.TestBean.findCustomer(TestBean.java:123)
at ejb.TestBean.verifyInsert(TestBean.java:78)
thanks,
-marina
RE: Cannot get QueryTimeout to work
Posted by Patrick Linskey <pl...@bea.com>.
I don't know what behavior to expect out of JDBC drivers outside of a
transaction.
Regarding avoiding transactions: in most situations, you should not see
any significant performance penalties for using transactions with
OpenJPA. The authors of Pro EJB3 are all Oracle employees, so maybe
there is something in their implementation that adds non-trivial
overhead to transactions.
-Patrick
--
Patrick Linskey
BEA Systems, Inc.
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
> -----Original Message-----
> From: Don Brady [mailto:dbrady@pobox.com]
> Sent: Thursday, March 22, 2007 4:48 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: Cannot get QueryTimeout to work
>
> Hi,
>
> I hope this is not off-topic on this list, but I cannot seem to get
> QueryTimeout to work, using the persistence.xml below under WebSphere
> 6.1 with a DB2 connection pool defined in WebSphere, under
> OpenJPA 0.9.6.
>
> It seems to just ignore the timeout specified and run to
> completion no
> longer how long it takes.
>
> I was wondering if the below should work or if there is
> another way of
> setting a query timeout. I cannot find one.
>
> Actually if I wrap it in a transaction, then I can set a timeout on
> the transaction and that does work. But I was avoiding using a
> transaction on the basis of advice in the book "Pro EJB" to omit
> transactions if they are not needed, in the case of a
> read-only query,
> because they may incur a performance penalty. Would that be true in
> OpenJPA for a large read-only query or should I just use a
> transaction
> and set the timeout on that?
>
> Thank you for any comments!
>
> Don
>
>
> persistence.xml contents:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0"
> xmlns="http://java.sun.com/xml/ns/persistence"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
>
> <persistence-unit name="mpu-prod" transaction-type="JTA">
> <provider>
>
> org.apache.openjpa.persistence.PersistenceProviderImpl
> </provider>
> <jta-data-source>jdbc/mship-prod</jta-data-source>
>
> <non-jta-data-source>jdbc/mship-prod</non-jta-data-source>
>
> <mapping-file>META-INF/orm-prod.xml</mapping-file>
>
> <exclude-unlisted-classes>false</exclude-unlisted-classes>
>
> <properties>
> <property name="openjpa.jdbc.Schema"
> value="PROD" />
> <property name="openjpa.DataCache"
> value="false" />
> <property
> name="openjpa.RemoteCommitProvider" value="sjvm" />
> <property name="openjpa.Log"
> value="DefaultLevel=WARN,
> Runtime=INFO, Tool=INFO, SQL=TRACE" />
> <property name="openjpa.jdbc.DBDictionary"
>
> value="db2(StoreCharsAsNumbers=false)" />
> <property
> name="openjpa.TransactionMode" value="managed" />
> <property
> name="openjpa.jdbc.TransactionIsolation"
> value="read-committed" />
> <property name="openjpa.ConnectionFactoryMode"
> value="managed" />
> <property
> name="openjpa.ConnectionFactoryProperties"
> value="QueryTimeout=30"/>
>
>
> </properties>
> </persistence-unit>
>
> </persistence>
>
Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.
Re: Cannot get QueryTimeout to work
Posted by "Lance J. Andersen" <La...@Sun.COM>.
Statement.setQueryTimeout() is required to be implemented in order to
achieve compliance with the JDBC specification. I would expect that
current JDBC drivers from the majority of the JDBC driver companies have
implemented this hopefully in a manner that works most of the time.
Marc Prud'hommeaux wrote:
>
> FYI, setQueryTimeout() will meter call Statement.setQueryTimeout() on
> the underlying driver. JDBC drivers frequently either don't implement
> this, or their implementation is very flawed. Unfortunately, we
> haven't done detailed analyses of which drivers properly implement it
> or not, so I don't know if DB2 has a proper implementation of it.
>
> One way to test our whether it is supported is to write a small
> stand-alone test case that directly creates a JDBC Connection and
> tries to execute a slow or blocking SQL statement on a Statement after
> you call setQueryTimeout() and see if it correctly times out. If it
> doesn't, then the problem is with the driver. If it does, then there's
> something wrong with OpenJPA and we can investigate further.
>
>
>
>
> On Mar 22, 2007, at 4:47 PM, Don Brady wrote:
>
>> Hi,
>>
>> I hope this is not off-topic on this list, but I cannot seem to get
>> QueryTimeout to work, using the persistence.xml below under WebSphere
>> 6.1 with a DB2 connection pool defined in WebSphere, under OpenJPA
>> 0.9.6.
>>
>> It seems to just ignore the timeout specified and run to completion
>> no longer how long it takes.
>>
>> I was wondering if the below should work or if there is another way
>> of setting a query timeout. I cannot find one.
>>
>> Actually if I wrap it in a transaction, then I can set a timeout on
>> the transaction and that does work. But I was avoiding using a
>> transaction on the basis of advice in the book "Pro EJB" to omit
>> transactions if they are not needed, in the case of a read-only
>> query, because they may incur a performance penalty. Would that be
>> true in OpenJPA for a large read-only query or should I just use a
>> transaction and set the timeout on that?
>>
>> Thank you for any comments!
>>
>> Don
>>
>>
>> persistence.xml contents:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <persistence version="1.0"
>> xmlns="http://java.sun.com/xml/ns/persistence"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
>>
>> <persistence-unit name="mpu-prod" transaction-type="JTA">
>> <provider>
>> org.apache.openjpa.persistence.PersistenceProviderImpl
>> </provider>
>> <jta-data-source>jdbc/mship-prod</jta-data-source>
>>
>> <non-jta-data-source>jdbc/mship-prod</non-jta-data-source>
>> <mapping-file>META-INF/orm-prod.xml</mapping-file>
>> <exclude-unlisted-classes>false</exclude-unlisted-classes>
>>
>> <properties>
>> <property name="openjpa.jdbc.Schema" value="PROD" />
>> <property name="openjpa.DataCache" value="false" />
>> <property name="openjpa.RemoteCommitProvider"
>> value="sjvm" />
>> <property name="openjpa.Log"
>> value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO,
>> SQL=TRACE" />
>> <property name="openjpa.jdbc.DBDictionary"
>> value="db2(StoreCharsAsNumbers=false)" />
>> <property name="openjpa.TransactionMode" value="managed" />
>> <property name="openjpa.jdbc.TransactionIsolation"
>> value="read-committed" />
>> <property name="openjpa.ConnectionFactoryMode"
>> value="managed" />
>> <property name="openjpa.ConnectionFactoryProperties"
>> value="QueryTimeout=30"/>
>>
>>
>> </properties>
>> </persistence-unit>
>>
>> </persistence>
>
Re: Cannot get QueryTimeout to work
Posted by "Lance J. Andersen" <La...@Sun.COM>.
Not sure if you use Statement.cancel() at all but this is an optional
method for JDBC and requires a SQLFeatureNotSupportedException to be
thrown if it is not supported (JDBC 4)
Patrick Linskey wrote:
> Also, you may be interested in the OpenJPAEntityManager.cancelAll()
> method call, which uses different JDBC pathways to kill running queries.
>
> -Patrick
>
>
RE: Cannot get QueryTimeout to work
Posted by Patrick Linskey <pl...@bea.com>.
Also, you may be interested in the OpenJPAEntityManager.cancelAll()
method call, which uses different JDBC pathways to kill running queries.
-Patrick
--
Patrick Linskey
BEA Systems, Inc.
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
> -----Original Message-----
> From: Marc Prud'hommeaux [mailto:mprudhomapache@gmail.com] On
> Behalf Of Marc Prud'hommeaux
> Sent: Thursday, March 22, 2007 5:09 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: Re: Cannot get QueryTimeout to work
>
>
> FYI, setQueryTimeout() will meter call
> Statement.setQueryTimeout() on
> the underlying driver. JDBC drivers frequently either don't
> implement
> this, or their implementation is very flawed. Unfortunately, we
> haven't done detailed analyses of which drivers properly
> implement it
> or not, so I don't know if DB2 has a proper implementation of it.
>
> One way to test our whether it is supported is to write a
> small stand-
> alone test case that directly creates a JDBC Connection and tries to
> execute a slow or blocking SQL statement on a Statement after you
> call setQueryTimeout() and see if it correctly times out. If it
> doesn't, then the problem is with the driver. If it does, then
> there's something wrong with OpenJPA and we can investigate further.
>
>
>
>
> On Mar 22, 2007, at 4:47 PM, Don Brady wrote:
>
> > Hi,
> >
> > I hope this is not off-topic on this list, but I cannot seem to
> > get QueryTimeout to work, using the persistence.xml below under
> > WebSphere 6.1 with a DB2 connection pool defined in WebSphere,
> > under OpenJPA 0.9.6.
> >
> > It seems to just ignore the timeout specified and run to
> > completion no longer how long it takes.
> >
> > I was wondering if the below should work or if there is another
> > way of setting a query timeout. I cannot find one.
> >
> > Actually if I wrap it in a transaction, then I can set a timeout
> > on the transaction and that does work. But I was avoiding
> using a
> > transaction on the basis of advice in the book "Pro EJB" to omit
> > transactions if they are not needed, in the case of a read-only
> > query, because they may incur a performance penalty. Would
> that be
> > true in OpenJPA for a large read-only query or should I just use a
> > transaction and set the timeout on that?
> >
> > Thank you for any comments!
> >
> > Don
> >
> >
> > persistence.xml contents:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <persistence version="1.0"
> > xmlns="http://java.sun.com/xml/ns/persistence"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://
> > java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> >
> > <persistence-unit name="mpu-prod" transaction-type="JTA">
> > <provider>
> >
> org.apache.openjpa.persistence.PersistenceProviderImpl
> > </provider>
> > <jta-data-source>jdbc/mship-prod</jta-data-source>
> >
> <non-jta-data-source>jdbc/mship-prod</non-jta-data-source>
> >
> <mapping-file>META-INF/orm-prod.xml</mapping-file>
> >
> <exclude-unlisted-classes>false</exclude-unlisted-classes>
> >
> > <properties>
> > <property name="openjpa.jdbc.Schema"
> value="PROD" />
> > <property name="openjpa.DataCache"
> value="false" />
> > <property
> name="openjpa.RemoteCommitProvider" value="sjvm" />
> > <property name="openjpa.Log"
> > value="DefaultLevel=WARN,
> Runtime=INFO, Tool=INFO, SQL=TRACE" />
> > <property name="openjpa.jdbc.DBDictionary"
> >
> value="db2(StoreCharsAsNumbers=false)" />
> > <property
> name="openjpa.TransactionMode" value="managed" />
> > <property
> name="openjpa.jdbc.TransactionIsolation"
> > value="read-committed" />
> > <property name="openjpa.ConnectionFactoryMode"
> > value="managed" />
> > <property
> name="openjpa.ConnectionFactoryProperties"
> > value="QueryTimeout=30"/>
> >
> >
> > </properties>
> > </persistence-unit>
> >
> > </persistence>
>
>
Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.
Re: Cannot get QueryTimeout to work
Posted by Marc Prud'hommeaux <mp...@apache.org>.
FYI, setQueryTimeout() will meter call Statement.setQueryTimeout() on
the underlying driver. JDBC drivers frequently either don't implement
this, or their implementation is very flawed. Unfortunately, we
haven't done detailed analyses of which drivers properly implement it
or not, so I don't know if DB2 has a proper implementation of it.
One way to test our whether it is supported is to write a small stand-
alone test case that directly creates a JDBC Connection and tries to
execute a slow or blocking SQL statement on a Statement after you
call setQueryTimeout() and see if it correctly times out. If it
doesn't, then the problem is with the driver. If it does, then
there's something wrong with OpenJPA and we can investigate further.
On Mar 22, 2007, at 4:47 PM, Don Brady wrote:
> Hi,
>
> I hope this is not off-topic on this list, but I cannot seem to
> get QueryTimeout to work, using the persistence.xml below under
> WebSphere 6.1 with a DB2 connection pool defined in WebSphere,
> under OpenJPA 0.9.6.
>
> It seems to just ignore the timeout specified and run to
> completion no longer how long it takes.
>
> I was wondering if the below should work or if there is another
> way of setting a query timeout. I cannot find one.
>
> Actually if I wrap it in a transaction, then I can set a timeout
> on the transaction and that does work. But I was avoiding using a
> transaction on the basis of advice in the book "Pro EJB" to omit
> transactions if they are not needed, in the case of a read-only
> query, because they may incur a performance penalty. Would that be
> true in OpenJPA for a large read-only query or should I just use a
> transaction and set the timeout on that?
>
> Thank you for any comments!
>
> Don
>
>
> persistence.xml contents:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0"
> xmlns="http://java.sun.com/xml/ns/persistence"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://
> java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
>
> <persistence-unit name="mpu-prod" transaction-type="JTA">
> <provider>
> org.apache.openjpa.persistence.PersistenceProviderImpl
> </provider>
> <jta-data-source>jdbc/mship-prod</jta-data-source>
> <non-jta-data-source>jdbc/mship-prod</non-jta-data-source>
> <mapping-file>META-INF/orm-prod.xml</mapping-file>
> <exclude-unlisted-classes>false</exclude-unlisted-classes>
>
> <properties>
> <property name="openjpa.jdbc.Schema" value="PROD" />
> <property name="openjpa.DataCache" value="false" />
> <property name="openjpa.RemoteCommitProvider" value="sjvm" />
> <property name="openjpa.Log"
> value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE" />
> <property name="openjpa.jdbc.DBDictionary"
> value="db2(StoreCharsAsNumbers=false)" />
> <property name="openjpa.TransactionMode" value="managed" />
> <property name="openjpa.jdbc.TransactionIsolation"
> value="read-committed" />
> <property name="openjpa.ConnectionFactoryMode"
> value="managed" />
> <property name="openjpa.ConnectionFactoryProperties"
> value="QueryTimeout=30"/>
>
>
> </properties>
> </persistence-unit>
>
> </persistence>
Cannot get QueryTimeout to work
Posted by Don Brady <db...@pobox.com>.
Hi,
I hope this is not off-topic on this list, but I cannot seem to get
QueryTimeout to work, using the persistence.xml below under WebSphere
6.1 with a DB2 connection pool defined in WebSphere, under OpenJPA 0.9.6.
It seems to just ignore the timeout specified and run to completion no
longer how long it takes.
I was wondering if the below should work or if there is another way of
setting a query timeout. I cannot find one.
Actually if I wrap it in a transaction, then I can set a timeout on
the transaction and that does work. But I was avoiding using a
transaction on the basis of advice in the book "Pro EJB" to omit
transactions if they are not needed, in the case of a read-only query,
because they may incur a performance penalty. Would that be true in
OpenJPA for a large read-only query or should I just use a transaction
and set the timeout on that?
Thank you for any comments!
Don
persistence.xml contents:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="mpu-prod" transaction-type="JTA">
<provider>
org.apache.openjpa.persistence.PersistenceProviderImpl
</provider>
<jta-data-source>jdbc/mship-prod</jta-data-source>
<non-jta-data-source>jdbc/mship-prod</non-jta-data-source>
<mapping-file>META-INF/orm-prod.xml</mapping-file>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="openjpa.jdbc.Schema" value="PROD" />
<property name="openjpa.DataCache" value="false" />
<property name="openjpa.RemoteCommitProvider" value="sjvm" />
<property name="openjpa.Log"
value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE" />
<property name="openjpa.jdbc.DBDictionary"
value="db2(StoreCharsAsNumbers=false)" />
<property name="openjpa.TransactionMode" value="managed" />
<property name="openjpa.jdbc.TransactionIsolation"
value="read-committed" />
<property name="openjpa.ConnectionFactoryMode"
value="managed" />
<property name="openjpa.ConnectionFactoryProperties"
value="QueryTimeout=30"/>
</properties>
</persistence-unit>
</persistence>
Re: Problem running JPA example from GlassFish page on GF+OpenJPA+Derby
Posted by Marina Vatkina <Ma...@Sun.COM>.
It's Java EE, i,e, run under the appserver. I'll let you know what is does the
tracing shows.
-marina
Patrick Linskey wrote:
> Did you run the OpenJPA enhancer on your classes before running the
> test, or, are you running in an environment that should be doing
> automatic class processing (such as a Java EE application server)?
>
> What do you get if you set the 'openjpa.Log' property to
> 'MetaData=TRACE'?
>
> -Patrick
>
Re: Problem running JPA example from GlassFish page on GF+OpenJPA+Derby
Posted by Marina Vatkina <Ma...@Sun.COM>.
No. I can't reproduce the problem. Sorry about the confusion.
-marina
Marina Vatkina wrote:
> Interesting... but after switching back to Derby, it all worked. Let me
> try and see if it's the 1st run after 1st deploy that causes any problems.
>
> -marina
>
> Patrick Linskey wrote:
>
>> Did you run the OpenJPA enhancer on your classes before running the
>> test, or, are you running in an environment that should be doing
>> automatic class processing (such as a Java EE application server)?
>>
>> What do you get if you set the 'openjpa.Log' property to
>> 'MetaData=TRACE'?
>>
>> -Patrick
>>
>
Re: Problem running JPA example from GlassFish page on GF+OpenJPA+Derby
Posted by Marina Vatkina <Ma...@Sun.COM>.
Interesting... but after switching back to Derby, it all worked. Let me try and
see if it's the 1st run after 1st deploy that causes any problems.
-marina
Patrick Linskey wrote:
> Did you run the OpenJPA enhancer on your classes before running the
> test, or, are you running in an environment that should be doing
> automatic class processing (such as a Java EE application server)?
>
> What do you get if you set the 'openjpa.Log' property to
> 'MetaData=TRACE'?
>
> -Patrick
>
RE: Problem running JPA example from GlassFish page on GF+OpenJPA+Derby
Posted by Patrick Linskey <pl...@bea.com>.
Did you run the OpenJPA enhancer on your classes before running the
test, or, are you running in an environment that should be doing
automatic class processing (such as a Java EE application server)?
What do you get if you set the 'openjpa.Log' property to
'MetaData=TRACE'?
-Patrick
--
Patrick Linskey
BEA Systems, Inc.
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
> -----Original Message-----
> From: Marina.Vatkina@Sun.COM [mailto:Marina.Vatkina@Sun.COM]
> Sent: Thursday, March 22, 2007 3:52 PM
> To: open-jpa-dev@incubator.apache.org
> Subject: Problem running JPA example from GlassFish page on
> GF+OpenJPA+Derby
>
> Hi,
>
> I tried to run our simple JPA example that can be found under
> (src and all)
> https://glassfish.dev.java.net/javaee5/persistence/persistence
> -example.html
> adding OpenJPA as the provider provider, and 'drop and
> create' tables settings
> to persistence.xml.
>
> The test inserts a customer and 2 orders, then runs a JPQL
> query to verify the
> insert, followed by delete and again verify.
>
> The same example works correctly on Oracle. I used the
> snapshot downloaded
> yesterday.
>
> 1. Derby had been identified correctly:
> [#|2007-03-22T14:55:01.920-0700|WARNING|sun-appserver9.1|javax
> .enterprise.system.stream.err|_ThreadID=20;_ThreadName=p:
>
> thread-pool-1; w:
> 3;_RequestID=80f667e2-03ab-4ccd-bb17-b8b4d0a88698;|495041 pu1
> INFO [p: thread-pool-1; w: 3] openjpa.jdbc.JDBC -
> OpenJPA will now connect
> to the database to attempt to determine what type of database
> dictionary to use.
> To prevent this connection in the future, set your
> openjpa.jdbc.DBDictionary
> configuration property to the appropriate value for your
> database (see the
> documentation for available values).
> |#]
>
> [#|2007-03-22T14:55:02.876-0700|WARNING|sun-appserver9.1|javax
> .enterprise.system.stream.err|_ThreadID=20;_ThreadName=p:
>
> thread-pool-1; w:
> 3;_RequestID=80f667e2-03ab-4ccd-bb17-b8b4d0a88698;|495997 pu1
> INFO [p: thread-pool-1; w: 3] openjpa.jdbc.JDBC - Using
> dictionary class
> "org.apache.openjpa.jdbc.sql.DerbyDictionary" (Apache Derby
> 10.2.2.0 - (485682)
> ,Apache Derby Network Client JDBC Driver 10.2.2.0 - (485682)).
> |#]
>
> 2. verifyInsert failed with:
>
> Caused by: <4|true|0.9.7-incubating-SNAPSHOT>
> org.apache.openjpa.persistence.ArgumentException: Could not
> locate metadata for
> the class using alias "Customer". Registered alias mappings:
> "{Customer=null}"
> at
> org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDat
> aRepository.java:345)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassM
> etaData(JPQLExpressionBuilder.java:164)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveCl
> assMetaData(JPQLExpressionBuilder.java:142)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandid
> ateMetaData(JPQLExpressionBuilder.java:211)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandid
> ateMetaData(JPQLExpressionBuilder.java:181)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getCandid
> ateType(JPQLExpressionBuilder.java:174)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.access$50
> 0(JPQLExpressionBuilder.java:61)
> at
> org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQ
> L.populate(JPQLExpressionBuilder.java:1668)
> at
> org.apache.openjpa.kernel.jpql.JPQLParser.populate(JPQLParser.java:52)
> at
> org.apache.openjpa.kernel.ExpressionStoreQuery.populateFromCom
> pilation(ExpressionStoreQuery.java:145)
> at
> org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:644)
> at
> org.apache.openjpa.kernel.QueryImpl.compilationFromCache(Query
> Impl.java:625)
> at
> org.apache.openjpa.kernel.QueryImpl.compileForCompilation(Quer
> yImpl.java:591)
> at
> org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryIm
> pl.java:653)
> at
> org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1475)
> at
> org.apache.openjpa.kernel.DelegatingQuery.getOperation(Delegat
> ingQuery.java:120)
> at
> org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:214)
> at
> org.apache.openjpa.persistence.QueryImpl.getSingleResult(Query
> Impl.java:282)
> at ejb.TestBean.findCustomer(TestBean.java:123)
> at ejb.TestBean.verifyInsert(TestBean.java:78)
>
> thanks,
> -marina
>
>
>
Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.