openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fernando Padilla <f...@alum.mit.edu>
Subject having issues with first query.
Date Thu, 16 Oct 2008 05:23:54 GMT
Hello.  I'm in the process of converting a project from JDO (kodo 
3.3.4), into OpenJPA.  And now I need some help, because it's failing on 
the second query that it runs. :)

Below you'll see the first query, loading up a "Fan" object via a field 
"fbId".  The second query tries to load a "TeamFan" object via 2 fields, 
  "fan" and "teamId".  "fan" is of type "Fan".  "teamId" is of type 
"TeamId", using @Externalizer.

For the second query it complains:
"The specified parameter of type "class 
com.protrade.fandom.data.entities.Fan" is not a valid query parameter."

Even though Fan is a valid Entity, that I just got from OpenJPA a 
fraction of a second before I used it in a query.

Please help! :)

Any ideas of what could be going on?






#1
The first query succeeds:

2008-10-15 22:05:56,381 [btpool0-1] DEBUG openjpa.Query - Executing 
query: [select this from com.protrade.fandom.data.entities.Fan this 
where this.fbId = :p0] with parameters: {p0=578696943}
2008-10-15 22:05:56,447 [btpool0-1] DEBUG openjpa.jdbc.SQL - <t 
10097681, conn 17988685> executing prepstmnt 29597895 SELECT t0.JDOID, 
t0.CREATETIME, t0.beboId, t0.fbId, t0.hi5Id, t0.mosId FROM FAN t0 WHERE 
(t0.fbId = ?) [params=(long) 578696943]
2008-10-15 22:05:56,448 [btpool0-1] DEBUG openjpa.jdbc.SQL - <t 
10097681, conn 17988685> [0 ms] spent
2008-10-15 22:05:56,459 [btpool0-1] DEBUG openjpa.DataCache - Cache miss 
while looking up key "com.protrade.fandom.data.entities.Fan-2".
2008-10-15 22:05:56,459 [btpool0-1] DEBUG openjpa.DataCache - Cache miss 
while looking up key "com.protrade.fandom.data.entities.Fan-2".
2008-10-15 22:05:56,463 [btpool0-1] DEBUG openjpa.DataCache - Put key 
"com.protrade.fandom.data.entities.Fan-2" into cache.
2008-10-15 22:05:56,463 [btpool0-1] DEBUG openjpa.DataCache - Cache hit 
while looking up key "com.protrade.fandom.data.entities.Fan-2".
2008-10-15 22:05:56,463 [btpool0-1] DEBUG openjpa.jdbc.JDBC - <t 
10097681, conn 17988685> [0 ms] close



#2
but the second query fails:

2008-10-15 22:05:56,530 [btpool0-1] DEBUG openjpa.Query - Executing 
query: [select this from com.protrade.fandom.data.entities.TeamFan this 
  where this.fan = :p0 AND this.teamId = :p1] with parameters: 
{p1=<<FbTeamId:FbTeam:2086>>, 
p0=com.protrade.fandom.data.entities.Fan@14d6015[
   beboId=<null>
   fbId=578696943
   hi5Id=<null>
   mosId=<null>
   createTime=1191032532627
   id=2
   jdoId=<null>
   jdoversion=0
]}
<openjpa-1.2.0-r422266:683325 nonfatal user error> 
org.apache.openjpa.persistence.ArgumentException: The specified 
parameter of type "class com.protrade.fandom.data.entities.Fan" is not a 
valid query parameter.
	at 
org.apache.openjpa.jdbc.sql.DBDictionary.setUnknown(DBDictionary.java:1348)
	at org.apache.openjpa.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:630)
	at 
org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:529)
	at 
org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:485)
	at 
org.apache.openjpa.jdbc.sql.SelectImpl.prepareStatement(SelectImpl.java:463)
	at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:379)
	at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:339)
	at 
org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.execute(LogicalUnion.java:420)
	at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:230)
	at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:220)
	at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:206)
	at 
org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(SelectResultObjectProvider.java:94)
	at org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1284)
	at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1221)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:990)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:848)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:779)
	at 
org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:525)
	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:253)
	at 
org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:316)
	at com.protrade.common.persistence.JPAUtil.execute(JPAUtil.java:142)

Mime
View raw message