-->
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.  [ 3 posts ] 
Author Message
 Post subject: org.hibernate.HibernateException: Errors in named queries
PostPosted: Fri Feb 02, 2007 12:00 pm 
Newbie

Joined: Fri Feb 02, 2007 11:50 am
Posts: 2
Hi Everyone,

I am trying to migrate from hibernate2 to hibernate3. I am getting the error in subject while running the code.
Here is the error stack:
java.lang.ExceptionInInitializerError
at com.mftl.gfas.junit.SpringBaseTest.setUp(SpringBaseTest.java:222)
at com.mftl.gfas.businessrules.TestBusinessRules.setUp(TestBusinessRules.java:41)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sybSessionFactory' defined in class path resource [hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Errors in named queries: ListStockLevels, ListGuestInvitationsWithoutHostParty, GetCountryByCode, AllProviders, GetAllStock, GetAccountByPortFolioPlan, LinkedDocumentTemplateNames, GetAccountByVirtualAgent, DequeuedJobsByDate, DequeuedJobs
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1032)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)
at com.mftl.gfas.util.BeanFactory.<init>(BeanFactory.java:36)
at com.mftl.gfas.util.BeanFactory.<clinit>(BeanFactory.java:21)
... 14 more
Caused by: org.hibernate.HibernateException: Errors in named queries: ListStockLevels, ListGuestInvitationsWithoutHostParty, GetCountryByCode, AllProviders, GetAllStock, GetAccountByPortFolioPlan, LinkedDocumentTemplateNames, GetAccountByVirtualAgent, DequeuedJobsByDate, DequeuedJobs
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:338)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:807)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:740)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:131)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)
... 25 more



Here is one of the mapping file where two of the named queries in error above are declared:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping package="com.mftl.gfas.fulfilment.business">
<class name="FulfilmentItemBO" table="FulfilmentItem">

<id type="com.mftl.gfas.type.MinusOneKey" name="itemId" column="ItemId">
<generator class="assigned"/>
</id>
<property name="itemName" column="ItemName" not-null="true"/>
<property name="status" column="StatusId" not-null="true"/>
<property name="includedIn" column="PackageId" not-null="false"/>
<property name="compliant" column="Compliance" not-null="true"/>
<property name="partCode" column="PartCode" not-null="true"/>
<property name="comment" column="Comment" not-null="false"/>
<property name="version" column="Version" not-null="true"/>
<many-to-one name="language" column="LanguageId" class="com.mftl.gfas.common.business.LanguageBO" not-null="false"/>
<!-- Mapping it to the FulfilmentCountryBO so that the values 0 (for 'All') can be taken care of -->
<!--<many-to-one name="country" column="CountryId" class="com.mftl.gfas.common.business.CountryBO" not-null="false"/>-->
<many-to-one name="country" column="CountryId" class="com.mftl.gfas.fulfilment.business.FulfilmentCountryBO" not-null="false"/>
<property name="maxOrderQuantity" column="MaxOrderQuantity" not-null="false"/>

<!-- this is done as some values like 0, 255 are inserted into Product Group column -->
<!-- property name="productGroupId" column="ProductGroupId" not-null="false" /-->
<!-- <many-to-one name="productGroup" column="ProductGroupId" class="com.mftl.gfas.common.business.ProductGroupBO" not-null="false"/>-->
<!-- Mapping it to the FulfilmentProductGroupBO so that the values 0 and 255 can be taken care of -->
<many-to-one name="productGroup" column="ProductGroupId" class="com.mftl.gfas.common.business.MarketingProductGroupBO" not-null="false"/>

<many-to-one name="fulfilmentType" column="TypeId" class="com.mftl.gfas.common.business.FulfilmentItemTypeBO" not-null="true"/>

<bag name="fulfilmentItemStockGroups" cascade="all" lazy="true">
<key column="FulfilmentItemId"/>
<one-to-many class="FulfilmentItemStockGroupBO"/>
</bag>

<bag name="enclosures" table="PackageEnclosure" cascade="all" lazy="true">
<key column="PackageId"/>
<many-to-many class="com.mftl.gfas.fulfilment.business.FulfilmentItemBO" column="ItemId"/>
</bag>

<!--bag name="fulfilmentItemVersions" table="FulfilmentItemVersion" cascade="all" lazy="true">
<key column="parentItemId"/>
<many-to-many class="com.mftl.gfas.fulfilment.business.FulfilmentItemBO" column="ItemId"/>
</bag-->

<bag name="fulfilmentItemVersions" table="FulfilmentItemVersion" cascade="all" lazy="true">
<key column="parentItemId"/>
<one-to-many class="FulfilmentItemVersionBO"/>
</bag>

<!--bag name="fulfilmentItemVersions" table="FulfilmentItemVersion">
<key column="ItemId"/>
<one-to-many class="com.mftl.gfas.fulfilment.business.FulfilmentItemVersionBO"/>
<composite-element class="com.mftl.gfas.fulfilment.business.FulfilmentItemVersionBO">
<many-to-one name="childItem" class="com.mftl.gfas.fulfilment.business.FulfilmentItemBO" column="ItemId"/>
<property name="parentItemId" column="ParentItemId" not-null="true"/>
<property name="latest" column="IsLatest" not-null="true"/>
<property name="version" column="Version" not-null="true"/>
</composite-element>
</bag-->

<bag name="workGroups" table="WorkGroupItems" cascade="all" lazy="true">
<key column="ItemId"/>
<many-to-many class="com.mftl.gfas.common.business.WorkGroupBO" column="WorkGroupId"/>
</bag>

</class>

<query name="ListStockLevels"><![CDATA[
select new com.mftl.gfas.fulfilment.business.StockLevelBO(f, h)
from FulfilmentItemBO as f
join elements(f.workGroups) as g
left join elements(f.fulfilmentItemStockGroups) as h
where g.WorkGroupKey=:selectedWorkGroupId
and f.fulfilmentType.FulfilmentItemTypeId != :fulfilmentItemType_LETTER
and f.fulfilmentType.FulfilmentItemTypeId != :fulfilmentItemType_PACKAGE
and f.fulfilmentType.inHouse = 0
and f.status = :fulfilmentItemStatus_STATUS_READY
order by f.itemName, f.itemId
] ]></query>

<query name="GetAllStock">
<![CDATA[
select new com.mftl.gfas.fulfilment.business.FulfilmentItemStockSummaryBO(
workgroup.name,
item.itemName,
stocklevel.physicalQuantity)
from FulfilmentItemBO as item
join elements(item.workGroups) as workgroup
join elements(item.fulfilmentItemStockGroups) as stocklevel
where workgroup.stockGroupId is not null
and stocklevel.stockGroup.id = workgroup.stockGroupId
and item.status = :fulfilmentItemStatus_STATUS_READY
order by item.status,
workgroup.name,
item.fulfilmentType.typeName,
item.itemName
]]>
</query>

</hibernate-mapping>



Can anyone of you please tell me what is wrong with the named query above? Thanks.

kind regards,
Ravi


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 05, 2007 8:19 am 
Expert
Expert

Joined: Tue Jan 30, 2007 12:45 am
Posts: 283
Location: India
Hi Ravi,

I think that your xml is corrupt

_________________
Dharmendra Pandey


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 05, 2007 12:04 pm 
Newbie

Joined: Fri Feb 02, 2007 11:50 am
Posts: 2
Hi Dharmendra,
Thanks for your reply. It doesn't look like that XML is corrupt. I opened XML in XML spy and it validates alright.

Anyother idea?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.