problem with ( )

閲覧: 6 回
最初の未読メッセージにスキップ

Mathieu

未読、
2011/04/27 9:51:282011/04/27
To: SimpleJPA
Hi !

I'm curently trying to use Simple JPA ( wich is very good, thanks to
the developpers :D )
I'm having trouble while using the ( )... Here is my request :

Query query = em.createQuery("select s from Session s where s.customer
= :customer and ( s.status = :status1 or s.status = :status2 )");

query.setParameter("customer", "1");
query.setParameter("status1", "open");
query.setParameter("status2", "uploading");

But at the execution, I get this erro :

Testcase: testGetRoot(unitTest.SessionTest): Caused an ERROR
parameter is null for: status2 )
javax.persistence.PersistenceException: parameter is null for:
status2 )
at
com.spaceprogram.simplejpa.query.QueryImpl.getParamValueAsStringForAmazonQuery(QueryImpl.java:
405)
at
com.spaceprogram.simplejpa.query.QueryImpl.appendCondition(QueryImpl.java:
388)
at
com.spaceprogram.simplejpa.query.QueryImpl.toAmazonQuery(QueryImpl.java:
270)
at
com.spaceprogram.simplejpa.query.QueryImpl.toAmazonQuery(QueryImpl.java:
270)
at
com.spaceprogram.simplejpa.query.QueryImpl.createAmazonQuery(QueryImpl.java:
173)
at
com.spaceprogram.simplejpa.query.QueryImpl.getResultList(QueryImpl.java:
104)
at sage.mybi.session.SessionTest.testGetRoot(SessionTest.java:
34)

I tried with or without space between characters and ( ) but still
failed...
Can anyone help me please ?

Travis Reeder

未読、
2011/04/27 11:15:212011/04/27
To: simp...@googlegroups.com
Are you positive "status2" is not null?  Is query.setParameter("status2", "uploading"); the exact code you are using?


--
You received this message because you are subscribed to the Google Groups "SimpleJPA" group.
To post to this group, send email to simp...@googlegroups.com.
To unsubscribe from this group, send email to simplejpa+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simplejpa?hl=en.


Mathieu

未読、
2011/04/28 6:01:452011/04/28
To: SimpleJPA
Yeah, that's the real source code...
I don't understand why the error occured.

Mathieu

未読、
2011/04/28 4:33:392011/04/28
To: SimpleJPA
Yeah, that's the real source code...
No intermediate variable

On 27 avr, 17:15, Travis Reeder <tree...@gmail.com> wrote:
全員に返信
投稿者に返信
転送
新着メール 0 件