has @SqlResultSetMapping been tested

2007-01-11 Thread George Hongell

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.

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">
	
		com.ibm.ws.persistence.entities.Person
 
		
			





			
			


			
			
			
		

	

<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.(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)



RE: has @SqlResultSetMapping been tested

2007-01-10 Thread Pinaki Poddar
Simple things (as below) work with 0.9.7 OpenJPA 

public void testSQLQuery() {
EntityManager em = getEM();
em.getTransaction().begin();
Person original = new Person();
original.setFirst("OpenJPA");
em.persist(original);
em.getTransaction().commit();

String sql = "SELECT ID,AGE,FIRST,LAST FROM XYZ WHERE
ID="+original.getId();
Query query = em.createNativeQuery(sql, "SQLMapping");
Person result = (Person)query.getSingleResult();
assertNotNull(result);
assertEquals(original.getFirst(), result.getFirst());

}

where in Person.java
@SqlResultSetMapping(name="SQLMapping",
[EMAIL PROTECTED](entityClass=Person.class))

Your test surely is more complex than the above. Can you send us an
isolated example test, persistence.xml and failure stack trace?


Pinaki Poddar
BEA Systems
415.402.7317  


-Original Message-
From: George Hongell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 10, 2007 10:24 AM
To: open-jpa-dev@incubator.apache.org
Subject: Re: has @SqlResultSetMapping been tested

Yes several instances of DeptBean were persisted before the
createNativequery was issued.  I am running 0.9.7-incubating-SNAPSHOT

On 1/10/07, Pinaki Poddar <[EMAIL PROTECTED]> wrote:
>
>
> > Query updateDeptName = _em.createNativeQuery(sql,"DeptBeanMapping");
> If any persistence operation using DeptBean.class preceeds this call 
> (e.g. _em.persist(new DeptBean())), then is there any change in 
> behavior?
>
> Pinaki Poddar
> BEA Systems
> 415.402.7317
>
>
> -Original Message-
> From: George Hongell [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 10, 2007 9:49 AM
> To: open-jpa-dev@incubator.apache.org
> Subject: Fwd: has @SqlResultSetMapping been tested
>
> I tried using both a native query and it failed, has it ever been 
> tested?
> also named native query with resultSetMapping fails at runtime, also 
> @SqlResultSetMappings does not seem to be implemented in openjpa and 
> fails in the MappingTool with *java.lang.ArrayStoreException*
>
> using
> @SqlResultSetMapping(name="DeptBeanMapping",
>   [EMAIL PROTECTED](entityClass=DeptBean.class )
> )
>
> this fails
> Query updateDeptName =
> _em.createNativeQuery(sql,"DeptBeanMapping");
> this works
> // Query updateDeptName =
_em.createNativeQuery(sql,DeptBean.class);
>
> <4|true|0.9.7-incubating-SNAPSHOT>
> org.apache.openjpa.persistence.ArgumentException:
>
> There is no query result mapping for "null" with name
"DeptBeanMapping".
>
> at 
> org.apache.openjpa.jdbc.meta.MappingRepository.getQueryResultMapping(
> MappingRepository.java:175)
>
> at org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.(
> 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.getResultList(QueryImpl.java
> :264)
>
> at com.ibm.ws.query.tests.JUNamedNativeQueryTest.testSelectDeptBean(
> JUNamedNativeQueryTest.java:457)
> __
> _
> 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.
>
___
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: has @SqlResultSetMapping been tested

2007-01-10 Thread George Hongell

Yes several instances of DeptBean were persisted before the
createNativequery was issued.  I am running 0.9.7-incubating-SNAPSHOT

On 1/10/07, Pinaki Poddar <[EMAIL PROTECTED]> wrote:



> Query updateDeptName = _em.createNativeQuery(sql,"DeptBeanMapping");
If any persistence operation using DeptBean.class preceeds this call
(e.g. _em.persist(new DeptBean())), then is there any change in
behavior?

Pinaki Poddar
BEA Systems
415.402.7317


-Original Message-
From: George Hongell [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 10, 2007 9:49 AM
To: open-jpa-dev@incubator.apache.org
Subject: Fwd: has @SqlResultSetMapping been tested

I tried using both a native query and it failed, has it ever been
tested?
also named native query with resultSetMapping fails at runtime, also
@SqlResultSetMappings does not seem to be implemented in openjpa and
fails in the MappingTool with *java.lang.ArrayStoreException*

using
@SqlResultSetMapping(name="DeptBeanMapping",
  [EMAIL PROTECTED](entityClass=DeptBean.class )
)

this fails
Query updateDeptName =
_em.createNativeQuery(sql,"DeptBeanMapping");
this works
// Query updateDeptName = _em.createNativeQuery(sql,DeptBean.class);

<4|true|0.9.7-incubating-SNAPSHOT>
org.apache.openjpa.persistence.ArgumentException:

There is no query result mapping for "null" with name "DeptBeanMapping".

at org.apache.openjpa.jdbc.meta.MappingRepository.getQueryResultMapping(
MappingRepository.java:175)

at org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.(
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.getResultList(QueryImpl.java
:264)

at com.ibm.ws.query.tests.JUNamedNativeQueryTest.testSelectDeptBean(
JUNamedNativeQueryTest.java:457)
___
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: has @SqlResultSetMapping been tested

2007-01-10 Thread Pinaki Poddar
 
> Query updateDeptName = _em.createNativeQuery(sql,"DeptBeanMapping");
If any persistence operation using DeptBean.class preceeds this call
(e.g. _em.persist(new DeptBean())), then is there any change in
behavior?

Pinaki Poddar
BEA Systems
415.402.7317  


-Original Message-
From: George Hongell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 10, 2007 9:49 AM
To: open-jpa-dev@incubator.apache.org
Subject: Fwd: has @SqlResultSetMapping been tested

 I tried using both a native query and it failed, has it ever been
tested?
also named native query with resultSetMapping fails at runtime, also
@SqlResultSetMappings does not seem to be implemented in openjpa and
fails in the MappingTool with *java.lang.ArrayStoreException*

using
 @SqlResultSetMapping(name="DeptBeanMapping",
   [EMAIL PROTECTED](entityClass=DeptBean.class )
  )

this fails
 Query updateDeptName =
_em.createNativeQuery(sql,"DeptBeanMapping");
this works
// Query updateDeptName = _em.createNativeQuery(sql,DeptBean.class);

<4|true|0.9.7-incubating-SNAPSHOT>
org.apache.openjpa.persistence.ArgumentException:

There is no query result mapping for "null" with name "DeptBeanMapping".

at org.apache.openjpa.jdbc.meta.MappingRepository.getQueryResultMapping(
MappingRepository.java:175)

at org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.(
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.getResultList(QueryImpl.java
:264)

at com.ibm.ws.query.tests.JUNamedNativeQueryTest.testSelectDeptBean(
JUNamedNativeQueryTest.java:457)
___
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: has @SqlResultSetMapping been tested

2007-01-10 Thread Patrick Linskey
What version of OpenJPA are you using? IIRC, there were issues, but they
were resolved a little while back.

-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: George Hongell [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, January 10, 2007 9:49 AM
> To: open-jpa-dev@incubator.apache.org
> Subject: Fwd: has @SqlResultSetMapping been tested
> 
>  I tried using both a native query and it failed, has it ever 
> been tested?
> also named native query with resultSetMapping fails at runtime,
> also @SqlResultSetMappings does not seem to be implemented in 
> openjpa and
> fails in the MappingTool with *java.lang.ArrayStoreException*
> 
> using
>  @SqlResultSetMapping(name="DeptBeanMapping",
>[EMAIL PROTECTED](entityClass=DeptBean.class )
>   )
> 
> this fails
>  Query updateDeptName = 
> _em.createNativeQuery(sql,"DeptBeanMapping");
> this works
> // Query updateDeptName = 
> _em.createNativeQuery(sql,DeptBean.class);
> 
> <4|true|0.9.7-incubating-SNAPSHOT>
> org.apache.openjpa.persistence.ArgumentException:
> 
> There is no query result mapping for "null" with name 
> "DeptBeanMapping".
> 
> at 
> org.apache.openjpa.jdbc.meta.MappingRepository.getQueryResultMapping(
> MappingRepository.java:175)
> 
> at org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.(
> 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.getResultList(QueryImpl.java
> :264)
> 
> at com.ibm.ws.query.tests.JUNamedNativeQueryTest.testSelectDeptBean(
> JUNamedNativeQueryTest.java:457)
> 


Fwd: has @SqlResultSetMapping been tested

2007-01-10 Thread George Hongell

I tried using both a native query and it failed, has it ever been tested?
also named native query with resultSetMapping fails at runtime,
also @SqlResultSetMappings does not seem to be implemented in openjpa and
fails in the MappingTool with *java.lang.ArrayStoreException*

using
@SqlResultSetMapping(name="DeptBeanMapping",
  [EMAIL PROTECTED](entityClass=DeptBean.class )
 )

this fails
Query updateDeptName = _em.createNativeQuery(sql,"DeptBeanMapping");
this works
// Query updateDeptName = _em.createNativeQuery(sql,DeptBean.class);

<4|true|0.9.7-incubating-SNAPSHOT>
org.apache.openjpa.persistence.ArgumentException:

There is no query result mapping for "null" with name "DeptBeanMapping".

at org.apache.openjpa.jdbc.meta.MappingRepository.getQueryResultMapping(
MappingRepository.java:175)

at org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.(
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.getResultList(QueryImpl.java
:264)

at com.ibm.ws.query.tests.JUNamedNativeQueryTest.testSelectDeptBean(
JUNamedNativeQueryTest.java:457)