-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate NamedQuery throwing MappedException
PostPosted: Mon Jan 03, 2005 10:11 pm 
Regular
Regular

Joined: Thu Jul 01, 2004 12:13 am
Posts: 68
Location: San Diego, CA
I have the named query below that I wanted to move from a class constant into a named query. I know the query works fine as a constant, but when I move it into a named query, it throws:

Initialization of bean failed; nested exception is net.sf.hibernate.MappingException: Error reading resource: com/mitchell/services/technical/claim/dao/vo/ClmDiary.hbm.xml

I have other queries I have successfully migrated. The only difference I see from the others is that this one has parens and single quotes, but that shouldn't make a diff. in a CDATA should it?

Thanks,
Lou

Code:
   <query name="findClaim">
      <![CDATA[from Claim as c inner join fetch c.diarySet d where d.claim = :claimId and d.claimExposure is null and ((d.accessibility = 'yyy') or (d.coCd = :companyCode1 and d.accessibility = 'xxx') or (d.coCd = :companyCode2 and d.accessibility = 'xxxzzz') or (d.coCd = :companyCode3 and d.epdOrgUserId = :epdOrgUserId))]]>
   </query>

Hibernate version:
2.1.6
Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 04, 2005 3:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you have a syntax error somewhere - and if you read the whole stack trace it should contain the original errors for this.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Re: Hibernate NamedQuery throwing MappedException
PostPosted: Tue Jan 04, 2005 6:17 am 
Newbie

Joined: Tue Jan 04, 2005 6:07 am
Posts: 1
Location: India
You could try removing the whitespace between the CDATA and query elements (start and end)


lsacco wrote:
I have the named query below that I wanted to move from a class constant into a named query. I know the query works fine as a constant, but when I move it into a named query, it throws:

Initialization of bean failed; nested exception is net.sf.hibernate.MappingException: Error reading resource: com/mitchell/services/technical/claim/dao/vo/ClmDiary.hbm.xml

I have other queries I have successfully migrated. The only difference I see from the others is that this one has parens and single quotes, but that shouldn't make a diff. in a CDATA should it?

Thanks,
Lou

Code:
   <query name="findClaim">
      <![CDATA[from Claim as c inner join fetch c.diarySet d where d.claim = :claimId and d.claimExposure is null and ((d.accessibility = 'yyy') or (d.coCd = :companyCode1 and d.accessibility = 'xxx') or (d.coCd = :companyCode2 and d.accessibility = 'xxxzzz') or (d.coCd = :companyCode3 and d.epdOrgUserId = :epdOrgUserId))]]>
   </query>

Hibernate version:
2.1.6
Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 04, 2005 1:49 pm 
Regular
Regular

Joined: Thu Jul 01, 2004 12:13 am
Posts: 68
Location: San Diego, CA
max wrote:
you have a syntax error somewhere - and if you read the whole stack trace it should contain the original errors for this.


Thanks Max...it was due to a duplicate query name. I wasn't aware you couldn't use the same query name across different HBM files. All query names must be unique across the whole project.

Best,
Lou


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