-->
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.  [ 5 posts ] 
Author Message
 Post subject: Where should this <sql-query declaration go???
PostPosted: Fri Dec 30, 2005 11:12 am 
Beginner
Beginner

Joined: Wed Dec 14, 2005 10:32 am
Posts: 20
Hi All,

I am trying to figure out where to put my stored procedure declaration call should go??

I have some thing like this:

<sql-query name="Sp_Picc" callable="true">
<return alias="rec" class="com.telcove.phoenix.picc.dao.common.PICCRecord">
<return-property name="saAcctNo" column="sa_account_num"/>

</return>
{ ? = call Sp_Picc_Batch_Process(?, ?, ?) }

</sql-query>

I have declared this in one of the xml mapping documents and I get the following error:

2005-12-30 10:07:34] DEBUG - 813 - org.hibernate.util.DTDEntityResolver - trying to locate http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath under org/hibernate/
[2005-12-30 10:07:34] DEBUG - 828 - org.hibernate.util.DTDEntityResolver - found http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd in classpath
[2005-12-30 10:07:34] ERROR - 844 - org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(21) Attribute "callable" must be declared for element type "sql-query".
[2005-12-30 10:07:34] ERROR - 844 - org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(23) Element type "return-property" must be declared.
[2005-12-30 10:07:34] ERROR - 844 - org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(25) The content of element type "return" must match "EMPTY".
Exception in thread "main" .

My question is: In which file I should put the <sql-query> element declaration??

Thanks in advance.

-Ram


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 30, 2005 5:39 pm 
Newbie

Joined: Fri Feb 06, 2004 1:37 pm
Posts: 9
That looks correct, I think that your problem is probably where your sql-query element is within the document. You probably have it inside of the <class> element or something like that. It should be a direct child of the <hibernate-mapping> element:

Code:
<hibernate-mapping package="com.foo.bar">
    <class name="Foo">
    ...
    </class>

    <sql-query name="listFoo" callable="true">
        <return class="FooClass">
            <return-property name="myKey">
                <return-column name="key1"/>
                <return-column name="key2"/>
            </return-property>
            <return-property name="prop1" column="col1"/>
        </return>
        {? = call myStoredProc(?, ?) }   
   </sql-query>            
</hibernate-mapping>
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 01, 2006 7:23 pm 
Beginner
Beginner

Joined: Wed Dec 14, 2005 10:32 am
Posts: 20
Hi,

Thanks for your reply...my 'sql-query' element was the direct child of 'hibernate-mapping' element.

I found something interesting...the dtd 'hibernate-mapping-3.0.dtd' that comes with the jar file had no definition for 'callable' attribute which is very strange. I took the latest dtd and replaced that in the 'jar' file which worked fine with no errors.

is there anybody else who found the same problem???

-Ram


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 10:26 am 
Newbie

Joined: Fri Feb 06, 2004 1:37 pm
Posts: 9
I just checked 4 different versions of 3.1 and 3.0 that I have downloaded locally, they all have the callable attribute defined in hibernate-mapping-3.0.dtd.

What version of hibernate are you using? Did you build the jar yourself or use the pre-packaged hibernate3.jar?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 4:00 pm 
Beginner
Beginner

Joined: Wed Dec 14, 2005 10:32 am
Posts: 20
I did use the one I got from the website... and I did not make any changes to it...


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