File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Can't reach NamedQuery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Can Watch "Can New topic

Can't reach NamedQuery

Michal Glowacki
Ranch Hand

Joined: Mar 14, 2006
Posts: 114

I am trying to use dependency injection from my Seam (web) application. Class:

CustomerAccount bean is created as separate project in Netbeans but deployed to the same JBoss instance. When I try to invoke function getLastNameDI() I get:

Named query not known: CustomerAccount.findByCustomerId

And my CustomerAccount bean is:

So there is a named query like this! Both persistence units (from web application and CustomerAccount) use the same datasource, just persistence units name vary.

What could be the problem?
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Query names are scoped to the persistence unit. So it will not be visible to the other persistence unit.

[My Blog]
All roads lead to JavaRanch
Michal Glowacki
Ranch Hand

Joined: Mar 14, 2006
Posts: 114
so how can I use dependency injection in my WAR to get EJB from JAR? I need to put EJB into JARs instead of creating EAR, because many applications share them.
I agree. Here's the link:
subject: Can't reach NamedQuery
It's not a secret anymore!