File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Can Watch "Can New topic
Author

Can't reach NamedQuery

Michal Glowacki
Ranch Hand

Joined: Mar 14, 2006
Posts: 114
eye,


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é
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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: http://aspose.com/file-tools
 
subject: Can't reach NamedQuery