This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
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.
 
 
subject: Can't reach NamedQuery
 
Similar Threads
Creating a MySQL table and Entity from Database.
Trying to figure out how to use MySQL and generated @Id
Sequence increment does not match its pre-allocation size.
tracking changes in an array in a session bean
Using Visual Web JavaServerFaces to display db data in a table