-->
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.  [ 2 posts ] 
Author Message
 Post subject: Named Queries
PostPosted: Fri May 28, 2010 6:00 pm 
Newbie

Joined: Fri May 28, 2010 1:12 pm
Posts: 3
When mapping functions/storedProcedures like below:

Code:
<sql-query name="PAADMINISTRACION.FNCONSPAISES" callable="true">
      <return alias="paises" class="com.example.Country" lock-mode="read">
         <return-property name="ID" column="FIPAISID"/>
         <return-property name="DESC" column="FCDESCRIPCION"/>
      </return>
   {? = call PAADMINISTRACION.FNCONSPAISES()}
   </sql-query>


Is it mandatory for com.example.Country to be mapped as an Entity ?

I´m getting the following:
Code:
org.hibernate.InvalidMappingException: Could not parse mapping document from resource Com/Elektra/MiSocio/Hibernate/ProceduresDefinition.hbm.xml
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:616)
   at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
   at Com.Elektra.MiSocio.Hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:30)
   at Com.Elektra.MiSocio.Test.Test2Query.main(Test2Query.java:20)

Caused by: org.hibernate.MappingException: must specify an identifier type: com.example.Country
   at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:418)
   at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:356)
   at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:295)
   at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:166)
   at org.hibernate.cfg.Configuration.add(Configuration.java:716)
   at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:551)
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:613)
   ... 7 more




Top
 Profile  
 
 Post subject: Re: Named Queries
PostPosted: Fri May 28, 2010 6:18 pm 
Newbie

Joined: Fri May 28, 2010 1:12 pm
Posts: 3
Ok I figured It Out

It does need a mapping class entity.
But it does not necessarily need to be a Table in the Schema.

Just this mapping was enough:

<class name="com.example.Country">
<id name="fipaisid" type="java.lang.Integer" />
<property name="fcdescripcion" type="java.lang.String" />
</class>

Hope this helps.


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