Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

namedQuery error : node to traverse cannot be null!

 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am trying to execute a namedQuery from a JUnit test class :



Here is the entity bean code :


I have this error :


It works well if i call this named query from a session bean.
Is this a problem of persistence context ?
Please enlighten me. Thanks.
[ September 02, 2008: Message edited by: Celinio Fernandes ]
 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Shouldn't it be "select p from People p where p.country = :theCountry"? Or "select c from Client c where c.country = :theCountry"?

Could you post both entities' (Person and Client) complete definition?
[ September 02, 2008: Message edited by: Sergio Tridente ]
 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey Sergio, good point, I made a wrong copy-paste.
I changed it in the initial post. There is only one entity : People.
Do you know where the problem is ?
 
krishna bulusu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

You should following method in EntityManager for named queries:

Hope this helps!!
 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, that was it :
createNamedQuery(...)
A simple mistake, thanks a lot again !
 
Hooman Peiro Sajjad
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Celinio Fernandes wrote:thanks, that was it :
createNamedQuery(...)
A simple mistake, thanks a lot again !


Hey guys, it's em.getNamedQuery(aString), isn't it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic