[jira] Commented: (OPENJPA-51) bad sql pushdown, sub select is missing from clause

2007-04-26 Thread Catalina Wei (JIRA)

[ 
https://issues.apache.org/jira/browse/OPENJPA-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12491902
 ] 

Catalina Wei commented on OPENJPA-51:
-

Abe, 
I am working on issue OPENJPA-51 for David Wisneski.
I need some education before attempting to resolve this issue.
How aliases in the subqueries are created and resolved ?
Consider the following 2 queries:
1. select o from Customer c, in(c.orders)o where o.amount  (select 
sum(o2.amount) from c.orders o2)
 2. select o from Order where o.amount  (select sum(o2.amount) from 
Customer c, in(c.orders) o2)

Aside from the semantic difference, in the 2 queries, the syntax difference is 
where Customer c  is defined.
When Customer c is defined in the subquery, the generated SQL has syntax error, 
essentially the FROM clause is missing the body and t2 in the selections is 
undefined:
SELECT t2.oid, t2.version, t2.amount, t2.customer_countryCode, t2.customer_id, 
t2.delivered 
FROM TCUSTOMER t0 INNER JOIN TORDER t1 ON t0.countryCode = 
t1.customer_countryCode AND t0.id = t1.customer_id WHERE (t2.amount  (SELECT 
SUM(t1.amount) FROM  ))

Under the debugger, it shows in which SelectImpl the aliases/tables are 
created/defined:

Query 1:_aliases  
_tables
   SelectImpl (main):TCUSTOMER=0  0=TCUSTOMER t0
   TORDER=1  
1=TORDER t1
   oders.o
   SelectImpl(subQ):TORDER=2   2=TORDER t2
   orders
   TORDER=3
   jpqlalias1:

   Query 2 (all aliase/tables are in the main SelectImpl, null in subQ's 
SelectImpl)
 SelectImpl(main):   TCUSTOMER=0  0=TCUSTOMER t0
   jpqlalias1:
   TORDER=1  
1=TORDER t1
   jpqlalias1:.orders.o2
   TORDER=2   
2=TORDER t2

  
It seems to me that openjpa assumes the alias defined in subquery is always 
derived from (i.e. correlated to) the main select.
Correct me if I am wrong.
I have tried changing the method in SelectImpl.findAlias(Table)
 to call  recordTableAlias() for subselect when the alias was found in parent 
select by the following code fragment:
  if (!fromParent  _parent != null) {
boolean removeFromParent = key.toString().contains(:);  //+
alias = _parent.findAlias(table, key, removeFromParent, this);  
//false = removeFromParent
if (alias != null) {
if (removeFromParent) //+
recordTableAlias(table, key, alias);  //+
return alias;
}
}

after this change, the SQL generates OK, but I do not think it is correct, 
because the subselect is missing the join predicate (missing where clause) for 
the path c.orders.
In debugging, I saw selectJoins for c.order s were created; one for the parent 
select and one for the subselect. But somehow the one created for subselect 
disappeared 
( or never got set in SelectImpl's _join field for subselect), the main 
SelectImpl's _join field seems to have the selectJoin for c.orders 
( but no SQL predicate was generated out of this selectJoin). 
Should the selectionJoin on the parent be moved to subselect ? How/When should 
this be done? 
Am I on the right track of resolving this issue? 
Your input is much appreciated.

Catalina


 bad sql pushdown, sub select is missing from clause
 ---

 Key: OPENJPA-51
 URL: https://issues.apache.org/jira/browse/OPENJPA-51
 Project: OpenJPA
  Issue Type: Bug
  Components: query
 Environment: Windows xp, db2, derby 
Reporter: George Hongell
 Assigned To: David Wisneski
 Fix For: 0.9.8

 Attachments: failureEntities.jar


 451 - bad sql pushdown sub select is missing from clause
  TEST451; select e from EmpBean e where e.empid  any (select e1.empid from 
 DeptBean d, in(d.emps) e1 where d.no = 200) 
 28344  TRACE  [main] openjpa.jdbc.SQL - t 1094861122, conn 295440796 [0 ms] 
 executing prepstmnt 81790176 SELECT t0.empid, t0.bonus, t2.deptno, t2.budget, 
 t2.name, t0.execLevel, t0.hireDate, t0.hireTime, t0.hireTimestamp, t3.street, 
 t3.city, t3.state, t3.zip, t0.isManager, t0.name, t0.salary, t4.street, 
 t4.city, t4.state, t4.zip FROM EmpBean t0 LEFT OUTER JOIN DeptBean t2 ON 
 t0.dept_deptno = t2.deptno LEFT OUTER JOIN AddressBean t3 ON t0.home_street = 
 t3.street LEFT OUTER JOIN AddressBean t4 ON 

RE: Open JPA error-Could not locate metadata for the class using alias

2007-04-26 Thread tbee



Patrick Linskey wrote:
 
 I think that if you do 1, 2, 3, 5, and 6, you should be in good shape.
 

This indeed seems to work!

BTW, Toplink just now also had its lazy loading issue solved: turns out
@MappedSuperclass classes must be listed in the persistence.xml.  The
solution actually was unexpected, it suddenly worked, after you told me to
do add them for the OpenJPA issue. You've solved two issues in one go! :-) 

So now I'm suddenly from no working library to two. Now to decide which one
to use.

Many thanks Patrick!
-- 
View this message in context: 
http://www.nabble.com/Open-JPA-error-Could-not-locate-metadata-for-the-class-using-alias-tf3561516.html#a10196445
Sent from the open-jpa-dev mailing list archive at Nabble.com.



RE: provide an actual JDBC connection?

2007-04-26 Thread Phill Moran
Have you tried to use Spring? I think you may be able to get that with
dependency injection. Not positive but thought I would throw in that suggestion 

-Original Message-
From: tbee [mailto:[EMAIL PROTECTED] 
Sent: April 26, 2007 5:10 AM
To: open-jpa-dev@incubator.apache.org
Subject: provide an actual JDBC connection?


Is it possible to provide an actual JDBC connection instead of connect
parameters?

The business model I'm trying to construct will work inside an existing
application which does direct JDBC. There is already a connection open and it
would be a waste of resource to have two. I can always hack together a special
Driver for this. Another solution would be to use the connection of OpenJPA.

One concern: how many actual JDBC connections are opened during a run. I assume
that only one is opened and that the JPA transaction concept is not directly
related to the JDBC transactions. That JDBC transactions are only used during a
JPA transaction's commit phase.
--
View this message in context:
http://www.nabble.com/provide-an-actual-JDBC-connection--tf3650466.html#a1019686
1
Sent from the open-jpa-dev mailing list archive at Nabble.com.



RE: provide an actual JDBC connection?

2007-04-26 Thread tbee



Phill Moran wrote:
 
 Have you tried to use Spring? I think you may be able to get that with
 dependency injection. Not positive but thought I would throw in that
 suggestion 
 

You really want to give me a heart attack? ;-) I'm not a spring fan.

-- 
View this message in context: 
http://www.nabble.com/provide-an-actual-JDBC-connection--tf3650466.html#a10200869
Sent from the open-jpa-dev mailing list archive at Nabble.com.



Re: [jira] Updated: (OPENJPA-229) OpenJPA fails with MappedSuperclasses and Entities with the same short names

2007-04-26 Thread Abe White
 Any thoughts about this patch? It changes how @Embeddable and
 @MappedSuperclass classes are enhanced.

I'd be a little nervous about NPEs registering a null alias, but it  
seems that it's been tested so apparently that's fine.  The only  
thing that might be missing is to put an if (alias != null) block  
around the code where we add a registered class's alias to the alias  
map in MetaDataRepository.processRegisteredClass().

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: provide an actual JDBC connection?

2007-04-26 Thread David Jencks


On Apr 26, 2007, at 2:10 AM, tbee wrote:



Is it possible to provide an actual JDBC connection instead of connect
parameters?


You can supply the datasource instance in a PersistenceUnitInfo, but  
I certainly hope you can't provide a connection.


The business model I'm trying to construct will work inside an  
existing
application which does direct JDBC. There is already a connection  
open and
it would be a waste of resource to have two. I can always hack  
together a
special Driver for this. Another solution would be to use the  
connection of

OpenJPA.


Are you running inside a javaee app server?  (not standalone tomcat)  
If so there's a very good chance that all the connection handles  
obtained within the same jta transaction actually use the same  
physical connection to the database.  Geronimo certainly does this.


One concern: how many actual JDBC connections are opened during a  
run. I
assume that only one is opened and that the JPA transaction  
concept is not
directly related to the JDBC transactions. That JDBC transactions  
are only

used during a JPA transaction's commit phase.


If you use table based sequences and supply a non-jta-datasource as  
well as a jta datasource, typically 2 connections will be used.   
However, if you are in an environment that does connection pooling  
this won't make much difference.


Hope this helps
david jencks



--
View this message in context: http://www.nabble.com/provide-an- 
actual-JDBC-connection--tf3650466.html#a10196861

Sent from the open-jpa-dev mailing list archive at Nabble.com.





RE: provide an actual JDBC connection?

2007-04-26 Thread Patrick Linskey
You can't provide a JDBC connection directly, but you can provide a
DataSource, which, in turn, can provide a connection.

-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: tbee [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 26, 2007 2:10 AM
 To: open-jpa-dev@incubator.apache.org
 Subject: provide an actual JDBC connection?
 
 
 Is it possible to provide an actual JDBC connection instead 
 of connect parameters?
 
 The business model I'm trying to construct will work inside 
 an existing application which does direct JDBC. There is 
 already a connection open and it would be a waste of resource 
 to have two. I can always hack together a special Driver for 
 this. Another solution would be to use the connection of OpenJPA.
 
 One concern: how many actual JDBC connections are opened 
 during a run. I assume that only one is opened and that the 
 JPA transaction concept is not directly related to the JDBC 
 transactions. That JDBC transactions are only used during a 
 JPA transaction's commit phase.
 --
 View this message in context: 
 http://www.nabble.com/provide-an-actual-JDBC-connection--tf365
0466.html#a10196861
 Sent from the open-jpa-dev mailing list archive at Nabble.com.
 
 

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: Open JPA error-Could not locate metadata for the class using alias

2007-04-26 Thread tbee



Patrick Linskey wrote:
 
 FYI, once I commit a fix to OPENJPA-229, you'll be able to use the same
 class names once again. Sorry about that bug.
 

Understood. Right now I'm in the connection debate: toplink cannot use less
than 2, so each of my fat clients will have 3 open (1 it already has). So
the decision is still open. It appears that using a business model this way
is not something that is done often.
-- 
View this message in context: 
http://www.nabble.com/Open-JPA-error-Could-not-locate-metadata-for-the-class-using-alias-tf3561516.html#a10204857
Sent from the open-jpa-dev mailing list archive at Nabble.com.



Re: provide an actual JDBC connection?

2007-04-26 Thread tbee



djencks wrote:
 
 You can supply the datasource instance in a PersistenceUnitInfo, but  
 I certainly hope you can't provide a connection.
 
 Are you running inside a javaee app server?  (not standalone tomcat)  
 If so there's a very good chance that all the connection handles  
 obtained within the same jta transaction actually use the same  
 physical connection to the database.  Geronimo certainly does this.
 

No, stand alone fat client. And I could hackup a datasource instead.
-- 
View this message in context: 
http://www.nabble.com/provide-an-actual-JDBC-connection--tf3650466.html#a10204809
Sent from the open-jpa-dev mailing list archive at Nabble.com.



RE: provide an actual JDBC connection?

2007-04-26 Thread Patrick Linskey
 
  Is it possible to provide an actual JDBC connection instead 
 of connect 
  parameters?
 
 You can supply the datasource instance in a 
 PersistenceUnitInfo, but I certainly hope you can't provide a 
 connection.

You can also specify a DataSource class name in the
openjpa.ConnectionFactory property; if it has a constructor that lines
up with the arguments you pass in the property value, OpenJPA will
construct it.

  The business model I'm trying to construct will work inside an 
  existing application which does direct JDBC. There is already a 
  connection open and it would be a waste of resource to have 
 two. I can 
  always hack together a special Driver for this. Another 
 solution would 
  be to use the connection of OpenJPA.
 
 Are you running inside a javaee app server?  (not standalone 
 tomcat) If so there's a very good chance that all the 
 connection handles obtained within the same jta transaction 
 actually use the same physical connection to the database.  
 Geronimo certainly does this.

If you just need to get OpenJPA's connection, you can do:

Connection c = (Connection) OpenJPAPersistence.cast(em).getConnection();

Do be careful to close that connection when you're done with it; OpenJPA
does reference-counting on connections to figure out when it's OK to
release connections (see below), and the getConnection() call counts. If
you do transactional work while using the connection, either don't close
the connection until after you call em.getTransaction().commit(), or set
your ConnectionRetainMode to 'transaction' or 'always'. This will ensure
that OpenJPA doesn't throw away the connection that you did your work
on.

  One concern: how many actual JDBC connections are opened 
 during a run. 
  I assume that only one is opened and that the JPA transaction
  concept is not
  directly related to the JDBC transactions. That JDBC 
 transactions are 
  only used during a JPA transaction's commit phase.

OpenJPA's behavior wrt. connections is controlled by the
openjpa.ConnectionRetainMode property. Briefly, by default, OpenJPA
holds onto connections for as short a time as possible, taking into
account things like flushes and datastore locking.

-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: David Jencks [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 26, 2007 9:07 AM
 To: open-jpa-dev@incubator.apache.org
 Subject: Re: provide an actual JDBC connection?
 
 
 On Apr 26, 2007, at 2:10 AM, tbee wrote:
 
 
  Is it possible to provide an actual JDBC connection instead 
 of connect 
  parameters?
 
 You can supply the datasource instance in a 
 PersistenceUnitInfo, but I certainly hope you can't provide a 
 connection.
 
  The business model I'm trying to construct will work inside an 
  existing application which does direct JDBC. There is already a 
  connection open and it would be a waste of resource to have 
 two. I can 
  always hack together a special Driver for this. Another 
 solution would 
  be to use the connection of OpenJPA.
 
 Are you running inside a javaee app server?  (not standalone 
 tomcat) If so there's a very good chance that all the 
 connection handles obtained within the same jta transaction 
 actually use the same physical connection to the database.  
 Geronimo certainly does this.
 
  One concern: how many actual JDBC connections are opened 
 during a run. 
  I assume that only one is opened and that the JPA transaction
  concept is not
  directly related to the JDBC transactions. That JDBC 
 transactions are 
  only used during a JPA transaction's commit phase.
 
 If you use table based sequences and supply a 
 non-jta-datasource as  
 well as a jta datasource, typically 2 connections will be used.   
 However, if you are in an environment that does connection 
 pooling this won't make much difference.
 
 Hope this helps
 david jencks
 
 
  --
  View this message in context: http://www.nabble.com/provide-an-
  actual-JDBC-connection--tf3650466.html#a10196861
  Sent from the open-jpa-dev mailing list archive at Nabble.com.
 
 
 

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 

RE: Open JPA error-Could not locate metadata for the class using alias

2007-04-26 Thread Patrick Linskey
 Many thanks Patrick!

You're welcome. 

FYI, once I commit a fix to OPENJPA-229, you'll be able to use the same
class names once again. Sorry about that bug.

-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: tbee [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 26, 2007 1:54 AM
 To: open-jpa-dev@incubator.apache.org
 Subject: RE: Open JPA error-Could not locate metadata for the 
 class using alias
 
 
 
 
 Patrick Linskey wrote:
  
  I think that if you do 1, 2, 3, 5, and 6, you should be in 
 good shape.
  
 
 This indeed seems to work!
 
 BTW, Toplink just now also had its lazy loading issue solved: 
 turns out @MappedSuperclass classes must be listed in the 
 persistence.xml.  The solution actually was unexpected, it 
 suddenly worked, after you told me to do add them for the 
 OpenJPA issue. You've solved two issues in one go! :-) 
 
 So now I'm suddenly from no working library to two. Now to 
 decide which one to use.
 
 Many thanks Patrick!
 --
 View this message in context: 
 http://www.nabble.com/Open-JPA-error-Could-not-locate-metadata
 -for-the-class-using-alias-tf3561516.html#a10196445
 Sent from the open-jpa-dev mailing list archive at Nabble.com.
 
 

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.


How to debug object retrieveal in JPA?

2007-04-26 Thread Phill Moran
Community,

How does one go about debugging object retrieval/creation. I continue to have
exceptions and little to go on as far as the cause.
The named JPQL is good since I know it generates a good sql (can trace code and
see it) . I know the sql is good as I can copy/paste it into mysql query
browser, execute and get the correct data back. The problem is that these lines
result in an NPE.

Query q =
this.getEntityManager().createNamedQuery(PersonFXStoreAndLogin);
q.setParameter(storeName, storeName.toUpperCase());
q.setParameter(loginName, loginName.toUpperCase());
ListPerson results = null;
try {
results = (ListPerson) q.getResultList();
System.out.println(results.size());
}
catch(Exception e) {
e.printStackTrace();
}
if (results.isEmpty()) { - NPE thrown here
throw new UserNotFoundException(No user found);
} 
Also the mappingTool validate seems to work fine. Of course how would I know
since I can find no description of what a good one looks like but reading it (no
exceptions) seem to make sense. 

Any help would be much appreciated.

Phill



RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Patrick Linskey
Could you post the full NPE? Is results null, or is the NPE coming from
within OpenJPA somewhere? OpenJPA shouldn't be returning a null
collection in any situation, I don't think.

One way to fish for causes of suspicious problems is to set the default
log level to TRACE:

property name=openjpa.Log value=DefaultLevel=TRACE/

This will generate tons of output, but the stuff towards the end might
provide something of value.

-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: Phill Moran [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 26, 2007 12:39 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: How to debug object retrieveal in JPA?
 
 Community,
 
 How does one go about debugging object retrieval/creation. I 
 continue to have exceptions and little to go on as far as the cause.
 The named JPQL is good since I know it generates a good sql 
 (can trace code and see it) . I know the sql is good as I can 
 copy/paste it into mysql query browser, execute and get the 
 correct data back. The problem is that these lines result in an NPE.
 
   Query q =
 this.getEntityManager().createNamedQuery(PersonFXStoreAndLogin);
   q.setParameter(storeName, storeName.toUpperCase());
   q.setParameter(loginName, loginName.toUpperCase());
   ListPerson results = null;
   try {
   results = (ListPerson) q.getResultList();
   System.out.println(results.size());
   }
   catch(Exception e) {
   e.printStackTrace();
   }
   if (results.isEmpty()) { - NPE thrown here
   throw new UserNotFoundException(No 
 user found);
   }
 Also the mappingTool validate seems to work fine. Of course 
 how would I know since I can find no description of what a 
 good one looks like but reading it (no
 exceptions) seem to make sense. 
 
 Any help would be much appreciated.
 
 Phill
 
 

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: How to debug object retrieveal in JPA?

2007-04-26 Thread Marc Prud'hommeaux

Phill-

The maximum verbosity of logging is obtained by specifying the  
openjpa.Log property to DefaultLevel=TRACE.


What is the full exception stack trace? We might be able to help  
identify the problem. In any case OpenJPA should never be throwing an  
NPE, so we should at least probably fix the error message.



On Apr 26, 2007, at 12:39 PM, Phill Moran wrote:


Community,

How does one go about debugging object retrieval/creation. I  
continue to have

exceptions and little to go on as far as the cause.
The named JPQL is good since I know it generates a good sql (can  
trace code and
see it) . I know the sql is good as I can copy/paste it into mysql  
query
browser, execute and get the correct data back. The problem is that  
these lines

result in an NPE.

Query q =
this.getEntityManager().createNamedQuery(PersonFXStoreAndLogin);
q.setParameter(storeName, storeName.toUpperCase());
q.setParameter(loginName, loginName.toUpperCase());
ListPerson results = null;
try {
results = (ListPerson) q.getResultList();
System.out.println(results.size());
}
catch(Exception e) {
e.printStackTrace();
}
if (results.isEmpty()) { - NPE thrown here
throw new UserNotFoundException(No user found);
}
Also the mappingTool validate seems to work fine. Of course how  
would I know
since I can find no description of what a good one looks like but  
reading it (no

exceptions) seem to make sense.

Any help would be much appreciated.

Phill





[jira] Resolved: (OPENJPA-229) OpenJPA fails with MappedSuperclasses and Entities with the same short names

2007-04-26 Thread Patrick Linskey (JIRA)

 [ 
https://issues.apache.org/jira/browse/OPENJPA-229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Patrick Linskey resolved OPENJPA-229.
-

Resolution: Fixed

 OpenJPA fails with MappedSuperclasses and Entities with the same short names
 

 Key: OPENJPA-229
 URL: https://issues.apache.org/jira/browse/OPENJPA-229
 Project: OpenJPA
  Issue Type: Bug
  Components: kernel
Affects Versions: 0.9.0, 0.9.6, 0.9.7
 Environment: WindowsXP SP2 full updates 2007-04-25, Informix 10, Java 
 1.6.0
Reporter: Patrick Linskey
 Fix For: 0.9.8

 Attachments: OPENJPA-229.patch


 When running the test case from OPENJPA-228 (after a few modifications to get 
 it working), I get the exception included below. If I change the 'Article' 
 mapped superclass to be named 'ArticleBase', things work.
 It looks like this is happening because multiple classes are registering for 
 the same alias. We should change the enhancer to not register aliases for 
 mapped superclasses.
 Exception in thread main 0.0.0 nonfatal user error 
 org.apache.openjpa.persistence.ArgumentException: 0
   at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:805)
   at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:766)
   at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:762)
   at 
 org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:517)
   at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:230)
   at 
 org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:269)
   at nl.reinders.bm.BMTestOpenJPA.main(BMTestOpenJPA.java:41)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
 Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
   at org.apache.openjpa.jdbc.kernel.exps.PCPath.appendTo(PCPath.java:636)
   at 
 org.apache.openjpa.jdbc.kernel.exps.FilterValueImpl.appendTo(FilterValueImpl.java:62)
   at 
 org.apache.openjpa.jdbc.kernel.exps.FilterValueImpl.appendTo(FilterValueImpl.java:58)
   at 
 org.apache.openjpa.jdbc.sql.DBDictionary.appendCast(DBDictionary.java:2486)
   at 
 org.apache.openjpa.jdbc.sql.DBDictionary.comparison(DBDictionary.java:2443)
   at 
 org.apache.openjpa.jdbc.kernel.exps.CompareExpression.appendTo(CompareExpression.java:75)
   at 
 org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.buildWhere(SelectConstructor.java:238)
   at 
 org.apache.openjpa.jdbc.kernel.exps.SelectConstructor.evaluate(SelectConstructor.java:79)
   at 
 org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.createWhereSelects(JDBCStoreQuery.java:330)
   at 
 org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery(JDBCStoreQuery.java:169)
   at 
 org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.executeQuery(ExpressionStoreQuery.java:677)
   at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:985)
   at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:796)
   ... 11 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Phill Moran
I did not mean it threw an NPE but I was left with a null result list. 

I have setup trace already and I actually get nothing back. Here is the trace
across the execution point

13734  WARN   [main] openjpa.MetaData - Found duplicate query
PersonFXLastFirst in class ca.BidSpec.emall.user.Person.  Ignoring.
22594  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 9575056 executing
prepstmnt 31103354 SELECT t0.id, t0.lastUpdated, t0.active, t0.activeFrom,
t0.activeUntil, t0.created, t0.displayName, t0.firstName, t0.lastLogin,
t0.lastName, t0.locale, t0.loginName, t0.middleName, t2.id, t2.lastUpdated,
t2.description, t3.id, t3.lastUpdated, t3.description, t2.value, t4.id,
t4.lastUpdated, t4.description, t4.categoryTypeFK, t4.value, t1.id,
t1.lastUpdated, t1.created, t1.description, t1.displayName, t1.name, t5.id,
t5.lastUpdated, t5.description, t5.categoryTypeFK, t5.value, t0.title,
t0.visible FROM person t0 INNER JOIN manufacturer t1 ON t0.manufacturerFK =
t1.id LEFT OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT OUTER JOIN category
t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON t1.typeFK = t5.id
LEFT OUTER JOIN categorytype t3 ON t2.categoryTypeFK = t3.id WHERE
(UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) ORDER BY t0.lastName ASC,
t0.firstName ASC [params=(String) BIDSPEC, (String) PMORAN]
22609  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 9575056 [15 ms] spent
27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 9575056 executing
prepstmnt 3888519 SELECT COUNT(*) FROM person t0 INNER JOIN manufacturer t1 ON
t0.manufacturerFK = t1.id LEFT OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT
OUTER JOIN category t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON
t1.typeFK = t5.id LEFT OUTER JOIN categorytype t3 ON t2.categoryTypeFK = t3.id
WHERE (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) [params=(String) BIDSPEC,
(String) PMORAN]
27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 9575056 [0 ms] spent
1
[2007-04-26 16:07:36,125] INFO  ca.BidSpec.testing.emall.UserFactoryTest Rolled
back transaction after test execution 

What is interesting is the line with a 1 (from
System.out.println(results.size())). What this represents is the message that
the result list is closed nothing else in the trace. 

So what causes the result list to be closed?

Phill

-Original Message-
From: Marc Prud'hommeaux [mailto:[EMAIL PROTECTED] On Behalf Of Marc
Prud'hommeaux
Sent: April 26, 2007 3:54 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: How to debug object retrieveal in JPA?

Phill-

The maximum verbosity of logging is obtained by specifying the openjpa.Log
property to DefaultLevel=TRACE.

What is the full exception stack trace? We might be able to help identify the
problem. In any case OpenJPA should never be throwing an NPE, so we should at
least probably fix the error message.


On Apr 26, 2007, at 12:39 PM, Phill Moran wrote:

 Community,

 How does one go about debugging object retrieval/creation. I continue 
 to have exceptions and little to go on as far as the cause.
 The named JPQL is good since I know it generates a good sql (can trace 
 code and see it) . I know the sql is good as I can copy/paste it into 
 mysql query browser, execute and get the correct data back. The 
 problem is that these lines result in an NPE.

   Query q =
 this.getEntityManager().createNamedQuery(PersonFXStoreAndLogin);
   q.setParameter(storeName, storeName.toUpperCase());
   q.setParameter(loginName, loginName.toUpperCase());
   ListPerson results = null;
   try {
   results = (ListPerson) q.getResultList();
   System.out.println(results.size());
   }
   catch(Exception e) {
   e.printStackTrace();
   }
   if (results.isEmpty()) { - NPE thrown here
   throw new UserNotFoundException(No user found);
   }
 Also the mappingTool validate seems to work fine. Of course how 
 would I know since I can find no description of what a good one looks 
 like but reading it (no
 exceptions) seem to make sense.

 Any help would be much appreciated.

 Phill




RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Patrick Linskey
 What is interesting is the line with a 1 (from 
 System.out.println(results.size())). What this represents is 
 the message that the result list is closed nothing else in 
 the trace. 
 
 So what causes the result list to be closed?

I don't follow -- I would assume that the '1' represents the numbers of
elements in the result list.

What happens if you change that to be 'System.out.println(results)'?

-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: Phill Moran [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 26, 2007 1:18 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: RE: How to debug object retrieveal in JPA?
 
 I did not mean it threw an NPE but I was left with a null 
 result list. 
 
 I have setup trace already and I actually get nothing back. 
 Here is the trace across the execution point
 
 13734  WARN   [main] openjpa.MetaData - Found duplicate query
 PersonFXLastFirst in class ca.BidSpec.emall.user.Person.  
 Ignoring.
 22594  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 
 9575056 executing prepstmnt 31103354 SELECT t0.id, 
 t0.lastUpdated, t0.active, t0.activeFrom, t0.activeUntil, 
 t0.created, t0.displayName, t0.firstName, t0.lastLogin, 
 t0.lastName, t0.locale, t0.loginName, t0.middleName, t2.id, 
 t2.lastUpdated, t2.description, t3.id, t3.lastUpdated, 
 t3.description, t2.value, t4.id, t4.lastUpdated, 
 t4.description, t4.categoryTypeFK, t4.value, t1.id, 
 t1.lastUpdated, t1.created, t1.description, t1.displayName, 
 t1.name, t5.id, t5.lastUpdated, t5.description, 
 t5.categoryTypeFK, t5.value, t0.title, t0.visible FROM person 
 t0 INNER JOIN manufacturer t1 ON t0.manufacturerFK = t1.id 
 LEFT OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT OUTER 
 JOIN category
 t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON 
 t1.typeFK = t5.id LEFT OUTER JOIN categorytype t3 ON 
 t2.categoryTypeFK = t3.id WHERE
 (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) ORDER BY 
 t0.lastName ASC, t0.firstName ASC [params=(String) BIDSPEC, 
 (String) PMORAN]
 22609  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 
 9575056 [15 ms] spent
 27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 
 9575056 executing prepstmnt 3888519 SELECT COUNT(*) FROM 
 person t0 INNER JOIN manufacturer t1 ON t0.manufacturerFK = 
 t1.id LEFT OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT 
 OUTER JOIN category t4 ON t0.salutationFK = t4.id LEFT OUTER 
 JOIN category t5 ON t1.typeFK = t5.id LEFT OUTER JOIN 
 categorytype t3 ON t2.categoryTypeFK = t3.id WHERE 
 (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) 
 [params=(String) BIDSPEC,
 (String) PMORAN]
 27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 
 9575056 [0 ms] spent
 1
 [2007-04-26 16:07:36,125] INFO  
 ca.BidSpec.testing.emall.UserFactoryTest Rolled back 
 transaction after test execution 
 
 What is interesting is the line with a 1 (from 
 System.out.println(results.size())). What this represents is 
 the message that the result list is closed nothing else in 
 the trace. 
 
 So what causes the result list to be closed?
 
 Phill
 
 -Original Message-
 From: Marc Prud'hommeaux [mailto:[EMAIL PROTECTED] On 
 Behalf Of Marc Prud'hommeaux
 Sent: April 26, 2007 3:54 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: Re: How to debug object retrieveal in JPA?
 
 Phill-
 
 The maximum verbosity of logging is obtained by specifying 
 the openjpa.Log
 property to DefaultLevel=TRACE.
 
 What is the full exception stack trace? We might be able to 
 help identify the problem. In any case OpenJPA should never 
 be throwing an NPE, so we should at least probably fix the 
 error message.
 
 
 On Apr 26, 2007, at 12:39 PM, Phill Moran wrote:
 
  Community,
 
  How does one go about debugging object retrieval/creation. 
 I continue 
  to have exceptions and little to go on as far as the cause.
  The named JPQL is good since I know it generates a good sql 
 (can trace 
  code and see it) . I know the sql is good as I can 
 copy/paste it into 
  mysql query browser, execute and get the correct data back. The 
  problem is that these lines result in an NPE.
 
  Query q =
  this.getEntityManager().createNamedQuery(PersonFXStoreAndLogin);
  q.setParameter(storeName, storeName.toUpperCase());
  q.setParameter(loginName, loginName.toUpperCase());
  ListPerson results = null;
  try {
  results = (ListPerson) 

RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Phill Moran
Some more information on this exception

Right after the execution the exception held inside the result is
com.sun.jdi.InvocationException occurred invoking method... Can't seem to get
more data out of it 

Once the system.out is executed the exception changes to The result list has
been closed

-Original Message-
From: Phill Moran [mailto:[EMAIL PROTECTED] 
Sent: April 26, 2007 4:18 PM
To: open-jpa-dev@incubator.apache.org
Subject: RE: How to debug object retrieveal in JPA?

I did not mean it threw an NPE but I was left with a null result list. 

I have setup trace already and I actually get nothing back. Here is the trace
across the execution point

13734  WARN   [main] openjpa.MetaData - Found duplicate query
PersonFXLastFirst in class ca.BidSpec.emall.user.Person.  Ignoring.
22594  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 9575056 executing
prepstmnt 31103354 SELECT t0.id, t0.lastUpdated, t0.active, t0.activeFrom,
t0.activeUntil, t0.created, t0.displayName, t0.firstName, t0.lastLogin,
t0.lastName, t0.locale, t0.loginName, t0.middleName, t2.id, t2.lastUpdated,
t2.description, t3.id, t3.lastUpdated, t3.description, t2.value, t4.id,
t4.lastUpdated, t4.description, t4.categoryTypeFK, t4.value, t1.id,
t1.lastUpdated, t1.created, t1.description, t1.displayName, t1.name, t5.id,
t5.lastUpdated, t5.description, t5.categoryTypeFK, t5.value, t0.title,
t0.visible FROM person t0 INNER JOIN manufacturer t1 ON t0.manufacturerFK =
t1.id LEFT OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT OUTER JOIN category
t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON t1.typeFK = t5.id
LEFT OUTER JOIN categorytype t3 ON t2.categoryTypeFK = t3.id WHERE
(UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) ORDER BY t0.lastName ASC,
t0.firstName ASC [params=(String) BIDSPEC, (String) PMORAN]
22609  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 9575056 [15 ms] spent
27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 9575056 executing
prepstmnt 3888519 SELECT COUNT(*) FROM person t0 INNER JOIN manufacturer t1 ON
t0.manufacturerFK = t1.id LEFT OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT
OUTER JOIN category t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON
t1.typeFK = t5.id LEFT OUTER JOIN categorytype t3 ON t2.categoryTypeFK = t3.id
WHERE (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) [params=(String) BIDSPEC,
(String) PMORAN]
27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 9575056 [0 ms] spent
1
[2007-04-26 16:07:36,125] INFO  ca.BidSpec.testing.emall.UserFactoryTest Rolled
back transaction after test execution 

What is interesting is the line with a 1 (from
System.out.println(results.size())). What this represents is the message that
the result list is closed nothing else in the trace. 

So what causes the result list to be closed?

Phill

-Original Message-
From: Marc Prud'hommeaux [mailto:[EMAIL PROTECTED] On Behalf Of Marc
Prud'hommeaux
Sent: April 26, 2007 3:54 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: How to debug object retrieveal in JPA?

Phill-

The maximum verbosity of logging is obtained by specifying the openjpa.Log
property to DefaultLevel=TRACE.

What is the full exception stack trace? We might be able to help identify the
problem. In any case OpenJPA should never be throwing an NPE, so we should at
least probably fix the error message.


On Apr 26, 2007, at 12:39 PM, Phill Moran wrote:

 Community,

 How does one go about debugging object retrieval/creation. I continue 
 to have exceptions and little to go on as far as the cause.
 The named JPQL is good since I know it generates a good sql (can trace 
 code and see it) . I know the sql is good as I can copy/paste it into 
 mysql query browser, execute and get the correct data back. The 
 problem is that these lines result in an NPE.

   Query q =
 this.getEntityManager().createNamedQuery(PersonFXStoreAndLogin);
   q.setParameter(storeName, storeName.toUpperCase());
   q.setParameter(loginName, loginName.toUpperCase());
   ListPerson results = null;
   try {
   results = (ListPerson) q.getResultList();
   System.out.println(results.size());
   }
   catch(Exception e) {
   e.printStackTrace();
   }
   if (results.isEmpty()) { - NPE thrown here
   throw new UserNotFoundException(No user found);
   }
 Also the mappingTool validate seems to work fine. Of course how 
 would I know since I can find no description of what a good one looks 
 like but reading it (no
 exceptions) seem to make sense.

 Any help would be much appreciated.

 Phill




RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Phill Moran
I changed the print statement you asked about and got a
[EMAIL PROTECTED] It holds the exception I
mentioned in the last email (out of sync with this one)

Phill

-Original Message-
From: Patrick Linskey [mailto:[EMAIL PROTECTED] 
Sent: April 26, 2007 4:35 PM
To: open-jpa-dev@incubator.apache.org
Subject: RE: How to debug object retrieveal in JPA?

 What is interesting is the line with a 1 (from 
 System.out.println(results.size())). What this represents is the 
 message that the result list is closed nothing else in the trace.
 
 So what causes the result list to be closed?

I don't follow -- I would assume that the '1' represents the numbers of elements
in the result list.

What happens if you change that to be 'System.out.println(results)'?

-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: Phill Moran [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 26, 2007 1:18 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: RE: How to debug object retrieveal in JPA?
 
 I did not mean it threw an NPE but I was left with a null result list.
 
 I have setup trace already and I actually get nothing back. 
 Here is the trace across the execution point
 
 13734  WARN   [main] openjpa.MetaData - Found duplicate query
 PersonFXLastFirst in class ca.BidSpec.emall.user.Person.  
 Ignoring.
 22594  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
 9575056 executing prepstmnt 31103354 SELECT t0.id,
 t0.lastUpdated, t0.active, t0.activeFrom, t0.activeUntil, t0.created, 
 t0.displayName, t0.firstName, t0.lastLogin, t0.lastName, t0.locale, 
 t0.loginName, t0.middleName, t2.id, t2.lastUpdated, t2.description, 
 t3.id, t3.lastUpdated, t3.description, t2.value, t4.id, 
 t4.lastUpdated, t4.description, t4.categoryTypeFK, t4.value, t1.id, 
 t1.lastUpdated, t1.created, t1.description, t1.displayName, t1.name, 
 t5.id, t5.lastUpdated, t5.description, t5.categoryTypeFK, t5.value, 
 t0.title, t0.visible FROM person t0 INNER JOIN manufacturer t1 ON 
 t0.manufacturerFK = t1.id LEFT OUTER JOIN category t2 ON t0.roleFK = 
 t2.id LEFT OUTER JOIN category
 t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON t1.typeFK 
 = t5.id LEFT OUTER JOIN categorytype t3 ON t2.categoryTypeFK = t3.id 
 WHERE
 (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) ORDER BY t0.lastName 
 ASC, t0.firstName ASC [params=(String) BIDSPEC,
 (String) PMORAN]
 22609  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
 9575056 [15 ms] spent
 27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
 9575056 executing prepstmnt 3888519 SELECT COUNT(*) FROM
 person t0 INNER JOIN manufacturer t1 ON t0.manufacturerFK = t1.id LEFT 
 OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT OUTER JOIN category 
 t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON t1.typeFK 
 = t5.id LEFT OUTER JOIN categorytype t3 ON t2.categoryTypeFK = t3.id 
 WHERE
 (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?)
 [params=(String) BIDSPEC,
 (String) PMORAN]
 27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
 9575056 [0 ms] spent
 1
 [2007-04-26 16:07:36,125] INFO
 ca.BidSpec.testing.emall.UserFactoryTest Rolled back transaction after 
 test execution
 
 What is interesting is the line with a 1 (from 
 System.out.println(results.size())). What this represents is the 
 message that the result list is closed nothing else in the trace.
 
 So what causes the result list to be closed?
 
 Phill
 
 -Original Message-
 From: Marc Prud'hommeaux [mailto:[EMAIL PROTECTED] On Behalf 
 Of Marc Prud'hommeaux
 Sent: April 26, 2007 3:54 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: Re: How to debug object retrieveal in JPA?
 
 Phill-
 
 The maximum verbosity of logging is obtained by specifying the 
 openjpa.Log
 property to DefaultLevel=TRACE.
 
 What is the full exception stack trace? We might be able to help 
 identify the problem. In any case OpenJPA should never be throwing an 
 NPE, so we should at least probably fix the error message.
 
 
 On Apr 26, 2007, at 12:39 PM, Phill Moran wrote:
 
  Community,
 
  How does one go about debugging object retrieval/creation. 
 I continue 
  to have exceptions and little to go on as far as the cause.
  The named JPQL is good since I know it generates a good sql 
 (can trace 
  code and see it) . I know the sql is good as I can 
 copy/paste it into 
  mysql query browser, execute and get the correct data back. The 
  problem is that these lines result in an NPE.
 
 

Re: More questions on runtime schema generation

2007-04-26 Thread David Jencks

Thanks for all the comments, I've learned a lot.

1. I have a classloader scanning strategy written and apparently  
working, however it is rather slow at least in geronimo.  Is anyone  
interested in it, seeing as how its not an appropriate approach in a  
app server according to Patrick's comment below?  I think it might  
still be useful as a last resort strategy.


2. It looks like the best strategy for geronimo to follow is to  
figure out which jars in an ee app can possibly have persistent  
classes in them and supply a list of those jars to the  
PersistenceUnitInfo.  IIUC scanning those jars is already implemented.


3. I can't get running ddl on a connection from an XADataSource in a  
simulated RequiresNew transaction to work reliably with derby.  The  
ddl appears to work fine but attempts to read data from the created  
sequence table hang until the tx times out and derby does not report  
any deadlocks.  Based on Craig's comments I've added a non-jta- 
datasource and this seems to be working much better.  Has anyone seen  
problems like this?  (seems unlikely in this context since i had to  
modify a bunch of stuff to get to this problem :-)


many thanks
david jencks

On Apr 25, 2007, at 3:56 PM, Patrick Linskey wrote:


Inside an appserver, there are parts of the PersistenceUnitInfo
interface that are designed for the appserver to communicate jars to
scan to the persistence provider.

-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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 25, 2007 3:55 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: More questions on runtime schema generation

The general solution to this problem lies in a crisper
definition of classloader domains in the app server. IIUC,
each app server has its own policies in terms of where
various components get loaded and when.

I think we need to engage the server spec team on this,
otherwise we will end up chasing multiple incompatible class
loader strategies, all of which turn out to be spec compliant.

And for a first cut at reasonable we might ask the Spring
folks how they handle this.

Craig

On Apr 25, 2007, at 12:26 PM, Patrick Linskey wrote:


However IIUC this dissects the system property java.class.path and
only parses stuff on that.  This might be reasonable for a command
line tool (although I have some
doubts) but it seems to me that for any other situation a

scan of the

provided classloader would be more appropriate.
Is this reasonable?


It is. Of course, there is no standard way to scan

classloaders. The

best I know of is to do:

cls.getProtectionDomain().getCodeSource().getLocation()

and then scan from that URL.

Of course, this assumes that a) you have a class (not a

ClassLoader),

b) you have security privileges to get the protection

domain, and b)

the location is parsable and accessible.

Is there some other way that you know of to scan a ClassLoader?


Also, I would like to suggest a flag in the
openjpa.jdbc.SynchronizeMappings=buildSchema(...) stuff to turn on
this eager scanning I'm trying to implement.  Does this seem
reasonable?


It does.

--
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: David Jencks [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 25, 2007 12:18 PM
To: open-jpa-dev@incubator.apache.org
Subject: More questions on runtime schema generation

I'm working on modifications so that ddl can operate in a separate
transaction on a connection from the jta ds and I would

like to have

a complete scan and enhancement as soon as possible when

the EMF is

first accessed.  I have this working when the classes are listed
explicitly in the persistence.xml but not when they aren't.

It looks like the relevant code is AbstractCFMetaDataFactory
getPersistentTypeNames

 if (names.isEmpty()  devpath)
 scan(new 

RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Patrick Linskey
So you're saying that the ResultList contains an Exception? Can you post
what you get if you do '((Exception) results.get(0)).printStackTrace()'?

-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: Phill Moran [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 26, 2007 1:44 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: RE: How to debug object retrieveal in JPA?
 
 Some more information on this exception
 
 Right after the execution the exception held inside the 
 result is com.sun.jdi.InvocationException occurred invoking 
 method... Can't seem to get more data out of it 
 
 Once the system.out is executed the exception changes to The 
 result list has been closed
 
 -Original Message-
 From: Phill Moran [mailto:[EMAIL PROTECTED]
 Sent: April 26, 2007 4:18 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: RE: How to debug object retrieveal in JPA?
 
 I did not mean it threw an NPE but I was left with a null 
 result list. 
 
 I have setup trace already and I actually get nothing back. 
 Here is the trace across the execution point
 
 13734  WARN   [main] openjpa.MetaData - Found duplicate query
 PersonFXLastFirst in class ca.BidSpec.emall.user.Person.  
 Ignoring.
 22594  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 
 9575056 executing prepstmnt 31103354 SELECT t0.id, 
 t0.lastUpdated, t0.active, t0.activeFrom, t0.activeUntil, 
 t0.created, t0.displayName, t0.firstName, t0.lastLogin, 
 t0.lastName, t0.locale, t0.loginName, t0.middleName, t2.id, 
 t2.lastUpdated, t2.description, t3.id, t3.lastUpdated, 
 t3.description, t2.value, t4.id, t4.lastUpdated, 
 t4.description, t4.categoryTypeFK, t4.value, t1.id, 
 t1.lastUpdated, t1.created, t1.description, t1.displayName, 
 t1.name, t5.id, t5.lastUpdated, t5.description, 
 t5.categoryTypeFK, t5.value, t0.title, t0.visible FROM person 
 t0 INNER JOIN manufacturer t1 ON t0.manufacturerFK = t1.id 
 LEFT OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT OUTER 
 JOIN category
 t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON 
 t1.typeFK = t5.id LEFT OUTER JOIN categorytype t3 ON 
 t2.categoryTypeFK = t3.id WHERE
 (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) ORDER BY 
 t0.lastName ASC, t0.firstName ASC [params=(String) BIDSPEC, 
 (String) PMORAN]
 22609  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 
 9575056 [15 ms] spent
 27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 
 9575056 executing prepstmnt 3888519 SELECT COUNT(*) FROM 
 person t0 INNER JOIN manufacturer t1 ON t0.manufacturerFK = 
 t1.id LEFT OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT 
 OUTER JOIN category t4 ON t0.salutationFK = t4.id LEFT OUTER 
 JOIN category t5 ON t1.typeFK = t5.id LEFT OUTER JOIN 
 categorytype t3 ON t2.categoryTypeFK = t3.id WHERE 
 (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) 
 [params=(String) BIDSPEC,
 (String) PMORAN]
 27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn 
 9575056 [0 ms] spent
 1
 [2007-04-26 16:07:36,125] INFO  
 ca.BidSpec.testing.emall.UserFactoryTest Rolled back 
 transaction after test execution 
 
 What is interesting is the line with a 1 (from 
 System.out.println(results.size())). What this represents is 
 the message that the result list is closed nothing else in 
 the trace. 
 
 So what causes the result list to be closed?
 
 Phill
 
 -Original Message-
 From: Marc Prud'hommeaux [mailto:[EMAIL PROTECTED] On 
 Behalf Of Marc Prud'hommeaux
 Sent: April 26, 2007 3:54 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: Re: How to debug object retrieveal in JPA?
 
 Phill-
 
 The maximum verbosity of logging is obtained by specifying 
 the openjpa.Log
 property to DefaultLevel=TRACE.
 
 What is the full exception stack trace? We might be able to 
 help identify the problem. In any case OpenJPA should never 
 be throwing an NPE, so we should at least probably fix the 
 error message.
 
 
 On Apr 26, 2007, at 12:39 PM, Phill Moran wrote:
 
  Community,
 
  How does one go about debugging object retrieval/creation. 
 I continue 
  to have exceptions and little to go on as far as the cause.
  The named JPQL is good since I know it generates a good sql 
 (can trace 
  code and see it) . I know the sql is good as I can 
 copy/paste it into 
  mysql query browser, execute and get the correct data back. The 
  problem is that these lines result in an NPE.
 
  Query q =
  

RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Phill Moran
Can't cast List to Exception 

-Original Message-
From: Patrick Linskey [mailto:[EMAIL PROTECTED] 
Sent: April 26, 2007 5:00 PM
To: open-jpa-dev@incubator.apache.org
Subject: RE: How to debug object retrieveal in JPA?

So you're saying that the ResultList contains an Exception? Can you post what
you get if you do '((Exception) results.get(0)).printStackTrace()'?

-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: Phill Moran [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 26, 2007 1:44 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: RE: How to debug object retrieveal in JPA?
 
 Some more information on this exception
 
 Right after the execution the exception held inside the result is 
 com.sun.jdi.InvocationException occurred invoking method... Can't 
 seem to get more data out of it
 
 Once the system.out is executed the exception changes to The result 
 list has been closed
 
 -Original Message-
 From: Phill Moran [mailto:[EMAIL PROTECTED]
 Sent: April 26, 2007 4:18 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: RE: How to debug object retrieveal in JPA?
 
 I did not mean it threw an NPE but I was left with a null result list.
 
 I have setup trace already and I actually get nothing back. 
 Here is the trace across the execution point
 
 13734  WARN   [main] openjpa.MetaData - Found duplicate query
 PersonFXLastFirst in class ca.BidSpec.emall.user.Person.  
 Ignoring.
 22594  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
 9575056 executing prepstmnt 31103354 SELECT t0.id,
 t0.lastUpdated, t0.active, t0.activeFrom, t0.activeUntil, t0.created, 
 t0.displayName, t0.firstName, t0.lastLogin, t0.lastName, t0.locale, 
 t0.loginName, t0.middleName, t2.id, t2.lastUpdated, t2.description, 
 t3.id, t3.lastUpdated, t3.description, t2.value, t4.id, 
 t4.lastUpdated, t4.description, t4.categoryTypeFK, t4.value, t1.id, 
 t1.lastUpdated, t1.created, t1.description, t1.displayName, t1.name, 
 t5.id, t5.lastUpdated, t5.description, t5.categoryTypeFK, t5.value, 
 t0.title, t0.visible FROM person t0 INNER JOIN manufacturer t1 ON 
 t0.manufacturerFK = t1.id LEFT OUTER JOIN category t2 ON t0.roleFK = 
 t2.id LEFT OUTER JOIN category
 t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON t1.typeFK 
 = t5.id LEFT OUTER JOIN categorytype t3 ON t2.categoryTypeFK = t3.id 
 WHERE
 (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) ORDER BY t0.lastName 
 ASC, t0.firstName ASC [params=(String) BIDSPEC,
 (String) PMORAN]
 22609  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
 9575056 [15 ms] spent
 27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
 9575056 executing prepstmnt 3888519 SELECT COUNT(*) FROM
 person t0 INNER JOIN manufacturer t1 ON t0.manufacturerFK = t1.id LEFT 
 OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT OUTER JOIN category 
 t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 ON t1.typeFK 
 = t5.id LEFT OUTER JOIN categorytype t3 ON t2.categoryTypeFK = t3.id 
 WHERE
 (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?)
 [params=(String) BIDSPEC,
 (String) PMORAN]
 27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
 9575056 [0 ms] spent
 1
 [2007-04-26 16:07:36,125] INFO
 ca.BidSpec.testing.emall.UserFactoryTest Rolled back transaction after 
 test execution
 
 What is interesting is the line with a 1 (from 
 System.out.println(results.size())). What this represents is the 
 message that the result list is closed nothing else in the trace.
 
 So what causes the result list to be closed?
 
 Phill
 
 -Original Message-
 From: Marc Prud'hommeaux [mailto:[EMAIL PROTECTED] On Behalf 
 Of Marc Prud'hommeaux
 Sent: April 26, 2007 3:54 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: Re: How to debug object retrieveal in JPA?
 
 Phill-
 
 The maximum verbosity of logging is obtained by specifying the 
 openjpa.Log
 property to DefaultLevel=TRACE.
 
 What is the full exception stack trace? We might be able to help 
 identify the problem. In any case OpenJPA should never be throwing an 
 NPE, so we should at least probably fix the error message.
 
 
 On Apr 26, 2007, at 12:39 PM, Phill Moran wrote:
 
  Community,
 
  How does one go about debugging object retrieval/creation. 
 I continue 
  to have exceptions and little to go on as far as the cause.
  The named JPQL is good since I know it generates a good sql 
 (can trace 
  code and see it) . I know the sql is good as I can 
 copy/paste it into 
  

RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Patrick Linskey
 Can you post what you get if you do '((Exception) 
 results.get(0)).printStackTrace()'?

... so results.get(0) is returning a List? That's very odd. What if you
do:

System.out.println(results.get(0))?

If it is a List of Exceptions, what if you print out the stacks of the
exceptions in the list?

-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: Phill Moran [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 26, 2007 2:36 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: RE: How to debug object retrieveal in JPA?
 
 Can't cast List to Exception 
 
 -Original Message-
 From: Patrick Linskey [mailto:[EMAIL PROTECTED]
 Sent: April 26, 2007 5:00 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: RE: How to debug object retrieveal in JPA?
 
 So you're saying that the ResultList contains an Exception? 
 Can you post what you get if you do '((Exception) 
 results.get(0)).printStackTrace()'?
 
 -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: Phill Moran [mailto:[EMAIL PROTECTED]
  Sent: Thursday, April 26, 2007 1:44 PM
  To: open-jpa-dev@incubator.apache.org
  Subject: RE: How to debug object retrieveal in JPA?
  
  Some more information on this exception
  
  Right after the execution the exception held inside the result is 
  com.sun.jdi.InvocationException occurred invoking method... Can't 
  seem to get more data out of it
  
  Once the system.out is executed the exception changes to 
 The result 
  list has been closed
  
  -Original Message-
  From: Phill Moran [mailto:[EMAIL PROTECTED]
  Sent: April 26, 2007 4:18 PM
  To: open-jpa-dev@incubator.apache.org
  Subject: RE: How to debug object retrieveal in JPA?
  
  I did not mean it threw an NPE but I was left with a null 
 result list.
  
  I have setup trace already and I actually get nothing back. 
  Here is the trace across the execution point
  
  13734  WARN   [main] openjpa.MetaData - Found duplicate query
  PersonFXLastFirst in class ca.BidSpec.emall.user.Person.  
  Ignoring.
  22594  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
  9575056 executing prepstmnt 31103354 SELECT t0.id,
  t0.lastUpdated, t0.active, t0.activeFrom, t0.activeUntil, 
 t0.created, 
  t0.displayName, t0.firstName, t0.lastLogin, t0.lastName, t0.locale, 
  t0.loginName, t0.middleName, t2.id, t2.lastUpdated, t2.description, 
  t3.id, t3.lastUpdated, t3.description, t2.value, t4.id, 
  t4.lastUpdated, t4.description, t4.categoryTypeFK, t4.value, t1.id, 
  t1.lastUpdated, t1.created, t1.description, t1.displayName, 
 t1.name, 
  t5.id, t5.lastUpdated, t5.description, t5.categoryTypeFK, t5.value, 
  t0.title, t0.visible FROM person t0 INNER JOIN manufacturer t1 ON 
  t0.manufacturerFK = t1.id LEFT OUTER JOIN category t2 ON 
 t0.roleFK = 
  t2.id LEFT OUTER JOIN category
  t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 
 ON t1.typeFK 
  = t5.id LEFT OUTER JOIN categorytype t3 ON 
 t2.categoryTypeFK = t3.id 
  WHERE
  (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?) ORDER BY 
 t0.lastName 
  ASC, t0.firstName ASC [params=(String) BIDSPEC,
  (String) PMORAN]
  22609  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
  9575056 [15 ms] spent
  27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
  9575056 executing prepstmnt 3888519 SELECT COUNT(*) FROM
  person t0 INNER JOIN manufacturer t1 ON t0.manufacturerFK = 
 t1.id LEFT 
  OUTER JOIN category t2 ON t0.roleFK = t2.id LEFT OUTER JOIN category
  t4 ON t0.salutationFK = t4.id LEFT OUTER JOIN category t5 
 ON t1.typeFK 
  = t5.id LEFT OUTER JOIN categorytype t3 ON 
 t2.categoryTypeFK = t3.id 
  WHERE
  (UPPER(t1.name) = ? AND UPPER(t0.loginName) = ?)
  [params=(String) BIDSPEC,
  (String) PMORAN]
  27469  TRACE  [main] openjpa.jdbc.SQL - t 31845311, conn
  9575056 [0 ms] spent
  1
  [2007-04-26 16:07:36,125] INFO
  ca.BidSpec.testing.emall.UserFactoryTest 

Re: Open JPA error-Could not locate metadata for the class using alias

2007-04-26 Thread Marina Vatkina

tbee wrote:



Patrick Linskey wrote:


I think that if you do 1, 2, 3, 5, and 6, you should be in good shape.




This indeed seems to work!

BTW, Toplink just now also had its lazy loading issue solved: turns out
@MappedSuperclass classes must be listed in the persistence.xml. 


@MappedSuperclass must be listed (though providers can choose to help you there, 
the spec doesn't require them to do so) - see the spec section


6.2.1.6 mapping-file, jar-file, class, exclude-unlisted-classes

The following classes must be implicitly or explicitly denoted as managed 
persistence classes to be included within a persistence unit: entity classes; 
embeddable classes; mapped superclasses.


-marina

 The

solution actually was unexpected, it suddenly worked, after you told me to
do add them for the OpenJPA issue. You've solved two issues in one go! :-) 


So now I'm suddenly from no working library to two. Now to decide which one
to use.

Many thanks Patrick!


RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Phill Moran
Run that config gives us this lovely message:

0|false|0.9.6-incubating org.apache.openjpa.persistence.PersistenceException:
null
at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:851)
at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:748)
at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:773)
at
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:254)
at
org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2115)
at
org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:248)
at
org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(Inst
anceResultObjectProvider.java:56)
at
org.apache.openjpa.lib.rop.WindowResultList.getInternal(WindowResultList.java:12
8)
at
org.apache.openjpa.lib.rop.AbstractNonSequentialResultList.get(AbstractNonSequen
tialResultList.java:69)
at
org.apache.openjpa.kernel.DelegatingResultList.get(DelegatingResultList.java:241
)
at
ca.BidSpec.emall.user.PersonFactoryImpl.getLoginPersonValueObject(PersonFactoryI
mpl.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils
.java:304)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(Ref
lectiveMethodInvocation.java:172)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:139)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Transa
ctionInterceptor.java:107)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:161)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.j
ava:203)
at $Proxy34.getLoginPersonValueObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils
.java:304)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(Ref
lectiveMethodInvocation.java:172)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:139)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Transa
ctionInterceptor.java:107)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:161)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.j
ava:203)
at $Proxy34.getLoginPersonValueObject(Unknown Source)
at
ca.BidSpec.testing.emall.UserFactoryTest.testDelete(UserFactoryTest.java:119)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at
org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69
)
at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ac
cess$001(AbstractAnnotationAwareTransactionalTests.java:47)
at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.
run(AbstractAnnotationAwareTransactionalTests.java:115)
at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ru
nTest(AbstractAnnotationAwareTransactionalTests.java:180)
at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ru
nTestTimed(AbstractAnnotationAwareTransactionalTests.java:153)
at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ru
nBare(AbstractAnnotationAwareTransactionalTests.java:111)
at
org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:159)
at
org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:239)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at 

RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Patrick Linskey
 Caused by: java.lang.NullPointerException
   at java.util.Locale.toLowerCase(Locale.java:1060)
   at java.util.Locale.convertOldISOCodes(Locale.java:1083)
   at java.util.Locale.init(Locale.java:272)
   at java.util.Locale.init(Locale.java:302)
   at ca.BidSpec.emall.user.Person.pcsetLocale(Person.java:375)
   at ca.BidSpec.emall.user.Person.pcClearFields(Person.java)
   at ca.BidSpec.emall.user.Person.pcNewInstance(Person.java)
   at
 org.apache.openjpa.enhance.PCRegistry.newInstance(PCRegistry.java:117)

Now we're getting somewhere what happens if you remove the Locale
field from the Person class?

-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: Phill Moran [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, April 26, 2007 6:32 PM
 To: open-jpa-dev@incubator.apache.org
 Subject: RE: How to debug object retrieveal in JPA?
 
 Run that config gives us this lovely message:
 
 0|false|0.9.6-incubating 
 org.apache.openjpa.persistence.PersistenceException:
 null
   at 
 org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:851)
   at 
 org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:748)
   at
 org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStore
 Manager.java:773)
   at
 org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult
 .java:254)
   at
 org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(Selec
 tImpl.java:2115)
   at
 org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult
 .java:248)
   at
 org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.ge
 tResultObject(Inst
 anceResultObjectProvider.java:56)
   at
 org.apache.openjpa.lib.rop.WindowResultList.getInternal(Window
 ResultList.java:12
 8)
   at
 org.apache.openjpa.lib.rop.AbstractNonSequentialResultList.get
 (AbstractNonSequen
 tialResultList.java:69)
   at
 org.apache.openjpa.kernel.DelegatingResultList.get(DelegatingR
 esultList.java:241
 )
   at
 ca.BidSpec.emall.user.PersonFactoryImpl.getLoginPersonValueObj
 ect(PersonFactoryI
 mpl.java:99)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
 orImpl.java:39)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
 odAccessorImpl.jav
 a:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at
 org.springframework.aop.support.AopUtils.invokeJoinpointUsingR
 eflection(AopUtils
 .java:304)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.i
 nvokeJoinpoint(Ref
 lectiveMethodInvocation.java:172)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.p
 roceed(ReflectiveM
 ethodInvocation.java:139)
   at
 org.springframework.transaction.interceptor.TransactionInterce
 ptor.invoke(Transa
 ctionInterceptor.java:107)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.p
 roceed(ReflectiveM
 ethodInvocation.java:161)
   at
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(Jd
 kDynamicAopProxy.j
 ava:203)
   at $Proxy34.getLoginPersonValueObject(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccess
 orImpl.java:39)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
 odAccessorImpl.jav
 a:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at
 org.springframework.aop.support.AopUtils.invokeJoinpointUsingR
 eflection(AopUtils
 .java:304)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.i
 nvokeJoinpoint(Ref
 lectiveMethodInvocation.java:172)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.p
 roceed(ReflectiveM
 ethodInvocation.java:139)
   at
 org.springframework.transaction.interceptor.TransactionInterce
 ptor.invoke(Transa
 ctionInterceptor.java:107)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.p
 roceed(ReflectiveM
 ethodInvocation.java:161)
   at
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(Jd
 kDynamicAopProxy.j
 ava:203)
   at $Proxy34.getLoginPersonValueObject(Unknown Source)
   at
 ca.BidSpec.testing.emall.UserFactoryTest.testDelete(UserFactor
 yTest.java:119)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 

RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Phill Moran
I had suspected the Locale so I made a set/getLocale that communicate in String.
I figured that openJPA does not actually care how I implement.

But for this run I removed it completely and did a clean rebuild. Good news and
bad the exception changed: 


java.util.NoSuchElementException: The result list has been closed.
at
org.apache.openjpa.lib.rop.AbstractResultList.assertOpen(AbstractResultList.java
:91)
at
org.apache.openjpa.lib.rop.AbstractNonSequentialResultList.get(AbstractNonSequen
tialResultList.java:68)
at
org.apache.openjpa.kernel.DelegatingResultList.get(DelegatingResultList.java:241
)
at
ca.BidSpec.emall.user.PersonFactoryImpl.getLoginPersonValueObject(PersonFactoryI
mpl.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils
.java:304)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(Ref
lectiveMethodInvocation.java:172)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:139)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Transa
ctionInterceptor.java:107)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:161)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.j
ava:203)
at $Proxy34.getLoginPersonValueObject(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils
.java:304)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(Ref
lectiveMethodInvocation.java:172)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:139)
at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Transa
ctionInterceptor.java:107)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveM
ethodInvocation.java:161)
at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.j
ava:203)
at $Proxy34.getLoginPersonValueObject(Unknown Source)
at
ca.BidSpec.testing.emall.UserFactoryTest.testDelete(UserFactoryTest.java:119)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at
org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69
)
at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ac
cess$001(AbstractAnnotationAwareTransactionalTests.java:47)
at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.
run(AbstractAnnotationAwareTransactionalTests.java:115)
at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ru
nTest(AbstractAnnotationAwareTransactionalTests.java:180)
at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ru
nTestTimed(AbstractAnnotationAwareTransactionalTests.java:153)
at
org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.ru
nBare(AbstractAnnotationAwareTransactionalTests.java:111)
at
org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:159)
at
org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:239)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at
org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:29)

Re: provide an actual JDBC connection?

2007-04-26 Thread Marina Vatkina

Can you pass a connection from em to the other side instead?

tbee wrote:



djencks wrote:

You can supply the datasource instance in a PersistenceUnitInfo, but  
I certainly hope you can't provide a connection.


Are you running inside a javaee app server?  (not standalone tomcat)  
If so there's a very good chance that all the connection handles  
obtained within the same jta transaction actually use the same  
physical connection to the database.  Geronimo certainly does this.





No, stand alone fat client. And I could hackup a datasource instead.




RE: How to debug object retrieveal in JPA?

2007-04-26 Thread Phill Moran
I don't close it in anyway directly 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: April 26, 2007 11:16 PM
To: open-jpa-dev@incubator.apache.org
Subject: Re: How to debug object retrieveal in JPA?

Can it be that there is a glue code that closes EM in between? Just a thought...

-marina

Phill Moran wrote:
 I had suspected the Locale so I made a set/getLocale that communicate in
String.
 I figured that openJPA does not actually care how I implement.
 
 But for this run I removed it completely and did a clean rebuild. Good 
 news and bad the exception changed:
 
 
 java.util.NoSuchElementException: The result list has been closed.
   at
 org.apache.openjpa.lib.rop.AbstractResultList.assertOpen(AbstractResul
 tList.java
 :91)
   at
 org.apache.openjpa.lib.rop.AbstractNonSequentialResultList.get(Abstrac
 tNonSequen
 tialResultList.java:68)
   at
 org.apache.openjpa.kernel.DelegatingResultList.get(DelegatingResultLis
 t.java:241
 )
   at
 ca.BidSpec.emall.user.PersonFactoryImpl.getLoginPersonValueObject(Pers
 onFactoryI
 mpl.java:99)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
 orImpl.jav
 a:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at
 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflectio
 n(AopUtils
 .java:304)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoi
 npoint(Ref
 lectiveMethodInvocation.java:172)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(R
 eflectiveM
 ethodInvocation.java:139)
   at
 org.springframework.transaction.interceptor.TransactionInterceptor.inv
 oke(Transa
 ctionInterceptor.java:107)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(R
 eflectiveM
 ethodInvocation.java:161)
   at
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamic
 AopProxy.j
 ava:203)
   at $Proxy34.getLoginPersonValueObject(Unknown Source)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
 orImpl.jav
 a:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at
 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflectio
 n(AopUtils
 .java:304)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoi
 npoint(Ref
 lectiveMethodInvocation.java:172)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(R
 eflectiveM
 ethodInvocation.java:139)
   at
 org.springframework.transaction.interceptor.TransactionInterceptor.inv
 oke(Transa
 ctionInterceptor.java:107)
   at
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(R
 eflectiveM
 ethodInvocation.java:161)
   at
 org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamic
 AopProxy.j
 ava:203)
   at $Proxy34.getLoginPersonValueObject(Unknown Source)
   at
 ca.BidSpec.testing.emall.UserFactoryTest.testDelete(UserFactoryTest.java:119)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess
 orImpl.jav
 a:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at junit.framework.TestCase.runTest(TestCase.java:168)
   at junit.framework.TestCase.runBare(TestCase.java:134)
   at
 org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCa
 se.java:69
 )
   at
 org.springframework.test.annotation.AbstractAnnotationAwareTransaction
 alTests.ac
 cess$001(AbstractAnnotationAwareTransactionalTests.java:47)
   at

org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.
 run(AbstractAnnotationAwareTransactionalTests.java:115)
   at
 org.springframework.test.annotation.AbstractAnnotationAwareTransaction
 alTests.ru
 nTest(AbstractAnnotationAwareTransactionalTests.java:180)
   at
 org.springframework.test.annotation.AbstractAnnotationAwareTransaction
 alTests.ru
 nTestTimed(AbstractAnnotationAwareTransactionalTests.java:153)
   at
 org.springframework.test.annotation.AbstractAnnotationAwareTransaction
 alTests.ru
 nBare(AbstractAnnotationAwareTransactionalTests.java:111)
   at

org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:159)
   at

org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:239)
   at junit.framework.TestResult$1.protect(TestResult.java:110)
   at junit.framework.TestResult.runProtected(TestResult.java:128)
   at 

Re: provide an actual JDBC connection?

2007-04-26 Thread tbee



Marina Vatkina wrote:
 
 Can you pass a connection from em to the other side instead?
 

That would be an option tool using EM as a pool. I have to experiment with
OpenJPA connection behaviour a bit.
-- 
View this message in context: 
http://www.nabble.com/provide-an-actual-JDBC-connection--tf3650466.html#a10213595
Sent from the open-jpa-dev mailing list archive at Nabble.com.