When I recreated your example it worked. But when I moved persisting the entity from the test method to another method (in this case setup()) I get the failure that I have been experiencing. I am enclosing the entity, the test, the persistence.xml and the stack trace.
<?xml version="1.0"?> <persistence 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" version="1.0"> <persistence-unit name="mdd" transaction-type="RESOURCE_LOCAL"> <class>com.ibm.ws.persistence.entities.Person</class> <properties> <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource" /> <!-- udb2 type 2--> <!-- value="db2(StoreCharsAsNumbers=false)"/> --> <!-- --> <property name="openjpa.jdbc.DBDictionary" value="db2(StoreCharsAsNumbers=true)"/> <property name="openjpa.ConnectionProperties" value="DriverClassName=com.ibm.db2.jcc.DB2Driver,Url=jdbc:db2:dbclnt,Username=georgeh,Password=g1h0ngell" />
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /> <property name="openjpa.Log" value="SQL=TRACE" /> </properties> </persistence-unit> </persistence>
<4|true|0.9.7-incubating-SNAPSHOT> org.apache.openjpa.persistence.ArgumentException: There is no query result mapping for "null" with name "SQLMapping". at org.apache.openjpa.jdbc.meta.MappingRepository.getQueryResultMapping(MappingRepository.java:175) at org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.<init>(SQLStoreQuery.java:174) at org.apache.openjpa.jdbc.kernel.SQLStoreQuery.newDataStoreExecutor(SQLStoreQuery.java:143) at org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:718) at org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:676) at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:658) at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1463) 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 com.ibm.ws.query.tests.SqlResultSetMapppingCompare.testSQLQuery(SqlResultSetMapppingCompare.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:615) at junit.framework.TestCase.runTest(Unknown Source) at junit.framework.TestCase.runBare(Unknown Source) at junit.framework.TestResult$1.protect(Unknown Source) at junit.framework.TestResult.runProtected(Unknown Source) at junit.framework.TestResult.run(Unknown Source) at junit.framework.TestCase.run(Unknown Source) at junit.framework.TestSuite.runTest(Unknown Source) at junit.framework.TestSuite.run(Unknown Source) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)