-->
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.  [ 1 post ] 
Author Message
 Post subject: Errors in named queries Spring 3.x + JPA + Hibernate 3.3.2.G
PostPosted: Thu May 26, 2011 3:31 pm 
Newbie

Joined: Mon May 09, 2011 11:50 am
Posts: 8
Hi,

I've defined an entity with named query as follows
Code:
@Entity
@Table(name="CUSTOMER")
@NamedQuery(name="getAllCustomer",query="SELECT cust FROM CUSTOMER cust WHERE cust.STATUS=? AND cust.BILLING_CODE=?")
public class Customer implements Serializable {

   // entity properties and JPA annotated getters/setters
}



when I attempt to start the application, Context initialization fails with following error:
Code:
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: travelRequestPersistenUnit] Unable to build EntityManagerFactory
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
   at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
   at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
   at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
   ... 40 more
Caused by: org.hibernate.HibernateException: Errors in named queries: getAllCustomer
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:365)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
   at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)


In [url="http://www.docjar.com/html/api/org/hibernate/impl/SessionFactoryImpl.java.html"]Hibernate code[/url], I found this:
Code:
  480            // this will throw an error if there's something wrong.
  481            try {
  482               log.debug("Checking named query: " + queryName);
[b][color=#FF0000]  483               //TODO: BUG! this currently fails for named queries for non-POJO entities
[/color]  484               queryPlanCache.getHQLQueryPlan( qd.getQueryString(), false, [/b]CollectionHelper.EMPTY_MAP );
  485            }



Any suggestions???


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

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.