java - Error in Hibernate NamedQuery -
i'm sure stupid, can't figure out why hibernate upset named query. can please me? here's query , domain objects in reference, followed stacktrace.
@namedquery(name = "findsummaryreportrollups", query = "select new com.bean.summaryreportrollup(org.region, org.market, header.projectionyearmonth, detaillineitems.attribute, sum(detaillineitems.value)) header header inner join organizationext org on header.location = trim(org.id) inner join header.detaillineitems detaillineitems " + " header.location in (:locations) group org.region, org.market, header.projectionyearmonth, detaillineitems.attribute ")
header
@entity @table(name = "header") @sequencegenerator(name="header_seq", sequencename="header_seq", allocationsize=1) public class header implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy=generationtype.sequence, generator="header_seq") @column(name = "head_id", insertable = true, updatable = false) private long id; @onetomany(fetch = fetchtype.eager, cascade={cascadetype.all}) @joincolumn(name="head_id") private list<detaillineitem> detaillineitems; @column(name = "location", insertable = true, updatable = false) private string location; @column(name = "entry_date", insertable = true, updatable = false) private date entrydate; @column(name = "dm_apprvl_date") private date dmapprovaldate; @column(name = "last_updated") private date lastupdateddate; @column(name = "proj_year_month", insertable = true, updatable = false) private string projectionyearmonth; @transient private date projectionmonthdate; /* other stuff , methods */ }
detail line item
@entity @table(name = "detail") @sequencegenerator(name="detail_seq", sequencename="detail_seq", allocationsize=1) public class detaillineitem implements cloneable, serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy=generationtype.sequence, generator="detail_seq") @column(name = "detail_id") private long id; @manytoone @joincolumn(name="head_id", unique=false, nullable=false) @jsonignore private header header; @manytoone @joincolumn(name="attrib_id", unique=false, nullable=false) private attribute attribute; @manytoone @joincolumn(name="status_id", unique=false, nullable=false) private status status; private double value; /* other stuff , methods */ }
organizationext
@immutable @table(name="strdir") public class organizationext implements serializable { private static final long serialversionuid = -1064943317455028767l; @id @column(name="sys_id", insertable=false, updatable=false) private string id; @column(name="market", insertable=false, updatable=false) private string market; @column(name="region", insertable=false, updatable=false) private string region; /* other stuff , methods */ }
stack trace
[8/19/13 20:39:19:890 cdt] 0000001b extension e com.ibm.wsspi.webcontainer.extension.webextensionprocessor createservletwrapper error occured while preparing servlet initialization. javax.servlet.servletexception: srve0207e: uncaught initialization exception created servlet @ com.ibm.ws.webcontainer.servlet.servletwrapper.init(servletwrapper.java:377) @ com.ibm.ws.webcontainer.servlet.servletwrapperimpl.init(servletwrapperimpl.java:165) @ com.ibm.ws.webcontainer.servlet.servletwrapper.initialize(servletwrapper.java:1588) @ com.ibm.wsspi.webcontainer.extension.webextensionprocessor.createservletwrapper(webextensionprocessor.java:98) @ com.ibm.ws.webcontainer.webapp.webapp.getservletwrapper(webapp.java:936) @ com.ibm.ws.webcontainer.webapp.webapp.getservletwrapper(webapp.java:857) @ com.ibm.ws.webcontainer.webapp.webapp.initializetargetmappings(webapp.java:538) @ com.ibm.ws.webcontainer.webapp.webapp.commoninitializationfinish(webapp.java:360) @ com.ibm.ws.webcontainer.webapp.webappimpl.initialize(webappimpl.java:292) @ com.ibm.ws.webcontainer.webapp.webgroupimpl.addwebapplication(webgroupimpl.java:99) @ com.ibm.ws.webcontainer.virtualhostimpl.addwebapplication(virtualhostimpl.java:167) @ com.ibm.ws.webcontainer.wswebcontainer.addwebapp(wswebcontainer.java:722) @ com.ibm.ws.webcontainer.wswebcontainer.addwebapplication(wswebcontainer.java:607) @ com.ibm.ws.webcontainer.component.webcontainerimpl.install(webcontainerimpl.java:376) @ com.ibm.ws.webcontainer.component.webcontainerimpl.start(webcontainerimpl.java:668) @ com.ibm.ws.runtime.component.applicationmgrimpl.start(applicationmgrimpl.java:1162) @ com.ibm.ws.runtime.component.deployedapplicationimpl.firedeployedobjectstart(deployedapplicationimpl.java:1313) @ com.ibm.ws.runtime.component.deployedmoduleimpl.start(deployedmoduleimpl.java:611) @ com.ibm.ws.runtime.component.applicationmgrimpl.startmodule(applicationmgrimpl.java:1613) @ com.ibm.ws.runtime.component.applicationmgrimpl._startmodule(applicationmgrimpl.java:1561) @ com.ibm.ws.runtime.component.applicationmgrimpl$applicationnotifier.classchanged(applicationmgrimpl.java:1776) @ com.ibm.ws.classloader.classloadermanager.checkandnotify(classloadermanager.java:550) @ com.ibm.ws.classloader.classloadermanager.access$000(classloadermanager.java:82) @ com.ibm.ws.classloader.classloadermanager$reloadtimertask.alarm(classloadermanager.java:586) @ com.ibm.ejs.util.am._alarm.run(_alarm.java:127) @ com.ibm.ws.util.threadpool$worker.run(threadpool.java:1527) caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'org.springframework.dao.annotation.persistenceexceptiontranslationpostprocessor#0' defined in servletcontext resource [/web-inf/spring/services-jta-context.xml]: initialization of bean failed; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'entitymanagerfactory' defined in servletcontext resource [/web-inf/spring/services-jta-context.xml]: invocation of init method failed; nested exception javax.persistence.persistenceexception: [persistenceunit: projctnsunit] unable build entitymanagerfactory @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:527) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:456) @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:291) @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:222) @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:288) @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194) @ org.springframework.context.support.abstractapplicationcontext.registerbeanpostprocessors(abstractapplicationcontext.java:710) @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:410) @ org.springframework.web.context.contextloader.createwebapplicationcontext(contextloader.java:276) @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:197) @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:47) @ com.ibm.ws.webcontainer.webapp.webapp.notifyservletcontextcreated(webapp.java:1588) @ com.ibm.ws.webcontainer.webapp.webapp.commoninitializationfinish(webapp.java:350) ... 18 more caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'entitymanagerfactory' defined in servletcontext resource [/web-inf/spring/services-jta-context.xml]: invocation of init method failed; nested exception javax.persistence.persistenceexception: [persistenceunit: projctnsunit] unable build entitymanagerfactory @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1420) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:519) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:456) @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:291) @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:222) @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:288) @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:194) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.getbeansoftype(defaultlistablebeanfactory.java:398) @ org.springframework.beans.factory.beanfactoryutils.beansoftypeincludingancestors(beanfactoryutils.java:275) @ org.springframework.dao.support.persistenceexceptiontranslationinterceptor.detectpersistenceexceptiontranslators(persistenceexceptiontranslationinterceptor.java:139) @ org.springframework.dao.support.persistenceexceptiontranslationinterceptor.<init>(persistenceexceptiontranslationinterceptor.java:79) @ org.springframework.dao.annotation.persistenceexceptiontranslationadvisor.<init>(persistenceexceptiontranslationadvisor.java:70) @ org.springframework.dao.annotation.persistenceexceptiontranslationpostprocessor.setbeanfactory(persistenceexceptiontranslationpostprocessor.java:99) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeawaremethods(abstractautowirecapablebeanfactory.java:1439) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1408) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:519) ... 30 more caused by: javax.persistence.persistenceexception: [persistenceunit: projctnsunit] unable build entitymanagerfactory @ org.hibernate.ejb.ejb3configuration.buildentitymanagerfactory(ejb3configuration.java:915) @ org.hibernate.ejb.ejb3configuration.buildentitymanagerfactory(ejb3configuration.java:890) @ org.hibernate.ejb.hibernatepersistence.createcontainerentitymanagerfactory(hibernatepersistence.java:74) @ org.springframework.orm.jpa.localcontainerentitymanagerfactorybean.createnativeentitymanagerfactory(localcontainerentitymanagerfactorybean.java:225) @ org.springframework.orm.jpa.abstractentitymanagerfactorybean.afterpropertiesset(abstractentitymanagerfactorybean.java:308) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1477) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1417) ... 45 more caused by: org.hibernate.hibernateexception: errors in named queries: findsummaryreportrollups @ org.hibernate.internal.sessionfactoryimpl.<init>(sessionfactoryimpl.java:515) @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:1750) @ org.hibernate.ejb.entitymanagerfactoryimpl.<init>(entitymanagerfactoryimpl.java:94) @ org.hibernate.ejb.ejb3configuration.buildentitymanagerfactory(ejb3configuration.java:905) ... 51 more
it seems cannot execute left join unless map association between entities. in case, organizationext not mapped header, though location present.
so seems might create oracle view containing information , create hibernate mapping directly that.
Comments
Post a Comment