[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - SELECT NEW: unable to locate POJO class

elenctic87 do-not-reply at jboss.com
Tue Feb 10 11:14:01 EST 2009


I am executing a query as follows. It results in a compiler error because the POJO class is not found.


  | Query q = entityManager.createQuery("SELECT NEW org.domain.b1.ui.NonMappedClass(b.prop1, b.prop2) ...
  | 

The compiler in eclipse finds an HQL Syntax Error: unable to locate class [org.domain.b1.ui.NonMappedClass]. The class exists and may be instantiated normally outside of a query. It's a POJO class that's not in the same package as the Hibernate entities that were created from the database tables. From within the HQL Editor, this query works fine. It just won't compile in my code! I think I need to somehow notify Hibernate of this POJO class so that it is visible during compile. Any ideas how to do that? Is it a certain @ Annotation I need, or do I need to create a hibernate config xml file? Or maybe there is a completely different solution. Regardless, thank you for helping.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4208651#4208651

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4208651



More information about the jboss-user mailing list