-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: @NamedQuery problem
PostPosted: Fri Jul 28, 2006 2:45 pm 
Newbie

Joined: Fri Jul 28, 2006 2:31 pm
Posts: 4
Hi,

I'm using Glassfish and Hibernate to development some enterprise applications but I have a problem with @NamedQueries...I always get the following exception:
Code:
javax.persistence.PersistenceException: org.hibernate.MappingException: Named query not known: findAll


Here's a small example:
The entity bean
Code:
@Entity
@Table(name="Customer")
@NamedQueries({
@NamedQuery(name = "findAll", query = "SELECT c FROM Customer c")
})
public Customer implements Serializable {
...
}


The business interface
Code:
@Remote
public interface CustomerManager {
   public Customer[] getAll();
}


And the stateless session bean
Code:
@Stateless
public  CustomerManagerBean implements CustomerManager {
   @PersistenceContext(unitName="testPU")
   private EntityManager em;

   public Customer[] getAll() {
      // The following line throws the mapping exception - org.hibernate.MappingException: Named query not known: findAll
      Query q = em.createNamedQuery("findAll");
        ...
   }
}


Any clue how to solve this problem?

Thanx


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 28, 2006 7:01 pm 
Newbie

Joined: Fri Jul 28, 2006 2:31 pm
Posts: 4
Forget the post...
Another PEBKAC :(

All day to discover that in my build.xml the entity Customer was not included on the Jar file!

Have a nice weekend. I sure need one.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.