-->
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.  [ 9 posts ] 
Author Message
 Post subject: Executing stored procedure via hibernate with sybase
PostPosted: Mon May 22, 2006 8:45 am 
Regular
Regular

Joined: Mon May 22, 2006 8:32 am
Posts: 67
Hello,

after reading several postings, faq and the manual, i am still not able to execute a stored procedure via hibernate. Can anyone give me assistance?
I am trying to execute a procedure whith "username" to get a resultset with three columns:

Hibernate version:
3.1.3

Mapping documents:

<sql-query name="generic_password_check" callable="true">
<return alias="dbo_VIEW_GERMAN_INTERNALS_IDP" class="dbo_VIEW_GERMAN_INTERNALS_IDP">
<return-property name="screen_name" column="screen_name"/>
<return-property name="inhouse_login" column="inhouse_login"/>
<return-property name="peoplesoft_id" column="peoplesoft_id"/>

</return>
{ ? = ESDB.dbo.ta_generic_password_check(?) }
</sql-query>

Code between sessionFactory.openSession() and session.close():
Query hibQuery = null;
hibQuery = session.getNamedQuery("generic_password_check");
hibQuery.setReadOnly(true);
hibQuery.setString(1,userName);
List l = hibQuery.list();

for (i = 0; i< l.size();i++){
System.out.println((String)l.get(i));
}
Full stack trace of any exception that occurs:
46658 [http8080-Processor25] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(23) Attribute "callable" must be declared for element type "sql-query".
46658 [http8080-Processor25] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(25) Element type "return-property" must be declared.
46658 [http8080-Processor25] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(26) Element type "return-property" must be declared.
46658 [http8080-Processor25] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(27) Element type "return-property" must be declared.
46658 [http8080-Processor25] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(29) The content of element type "return" must match "EMPTY".
46674 [http8080-Processor25] ERROR com.sun.faces.lifecycle.InvokeApplicationPhase - #{Demologin.doLogin}: javax.faces.el.EvaluationException: org.hibernate.MappingException: Error reading resource: dbo_VIEW_GERMAN_INTERNALS_IDP.hbm.xml
javax.faces.FacesException: #{Demologin.doLogin}: javax.faces.el.EvaluationException: org.hibernate.MappingException: Error reading resource: dbo_VIEW_GERMAN_INTERNALS_IDP.hbm.xml
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
...
Name and version of the database you are using:
Sybase version ?

Whats is wrong with my config. What is wrong parsing my "dbo_VIEW_GERMAN_INTERNALS_IDP.hbm.xml"?

regards,

barnti


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 23, 2006 12:20 am 
Beginner
Beginner

Joined: Sat Jan 31, 2004 7:19 pm
Posts: 39
I am able to parse your mapping snippet just fine.

Maybe it's the DTD version?

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


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 23, 2006 12:24 am 
Beginner
Beginner

Joined: Sat Jan 31, 2004 7:19 pm
Posts: 39
Yep, that must be it, if I set the DTD version to 2, I get the same exception
as you did.

rate me up.
Cheers.
Martin


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 23, 2006 1:47 am 
Regular
Regular

Joined: Mon May 22, 2006 8:32 am
Posts: 67
Hi Martin,

thanks for your reply

mschulz wrote:
Yep, that must be it, if I set the DTD version to 2, I get the same exception
Martin


But how to correct that. And why is that an error. I used the newest package from hibernate and the dtd is included. So what are the next steps to get my stored procedure to run correctly?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 23, 2006 10:22 am 
Beginner
Beginner

Joined: Sat Jan 31, 2004 7:19 pm
Posts: 39
You need to use exactly the DTD reference in your Hibernate mapping
file as I have shown above.

You must have somehow picked the DTD reference from old Hibernate 2 examples or documentation.

Just make sure the lines at the top of your mapping file are:

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


And don't worry, it will still find the dtd file in the hibernate3.jar.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 23, 2006 10:29 am 
Regular
Regular

Joined: Mon May 22, 2006 8:32 am
Posts: 67
Hi,
mschulz wrote:
You need to use exactly the DTD reference in your Hibernate mapping
file as I have shown above.

You must have somehow picked the DTD reference from old Hibernate 2 examples or documentation.

Just make sure the lines at the top of your mapping file are:

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




These lines are exact that what appears in my files. I do not get the point...


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 24, 2006 10:26 am 
Beginner
Beginner

Joined: Sat Jan 31, 2004 7:19 pm
Posts: 39
... the point being is that the XML validation does _not_ lie.

Your Hibernate mapping _is_ valid with the Hibernate 3 DTD,
but it is _invalid_ with the Hibernate 2 DTD.

The errors you are getting are the same as when you validate
your mapping against the Hibernate 2 DTD.

Sinve you have not bothered to show your _full_ mapping file,
I have to take your last statement on good faith, but with a grain
of salt.

How you managed to get the DTD version mixed up is not obvious to
me, but several possibilities exist, such as having taken the Hibernate
2 DTD and renamed it locally, or whatever.

Dig around for files named hibernate-mapping-3.0.dtd in your class
path, or the hibernate jars and double check the content against
this link:
http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd

Similarly, chase down any hibernate-mapping-2.0.dtd files etc.

And just for yourself, double check that you really, really have "3.0"
and not "2.0" in the two relevant places of your mapping file.
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 24, 2006 10:27 am 
Beginner
Beginner

Joined: Sat Jan 31, 2004 7:19 pm
Posts: 39
... the point being is that the XML validation does _not_ lie.

Your Hibernate mapping _is_ valid with the Hibernate 3 DTD,
but it is _invalid_ with the Hibernate 2 DTD.

The errors you are getting are the same as when you validate
your mapping against the Hibernate 2 DTD.

Sinve you have not bothered to show your _full_ mapping file,
I have to take your last statement on good faith, but with a grain
of salt.

How you managed to get the DTD version mixed up is not obvious to
me, but several possibilities exist, such as having taken the Hibernate
2 DTD and renamed it locally, or whatever.

Dig around for files named hibernate-mapping-3.0.dtd in your class
path, or the hibernate jars and double check the content against
this link:
http://hibernate.sourceforge.net/hibern ... ng-3.0.dtd

Similarly, chase down any hibernate-mapping-2.0.dtd files etc.

And just for yourself, double check that you really, really have "3.0"
and not "2.0" in the two relevant places of your mapping file.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 17, 2009 10:47 am 
Newbie

Joined: Tue Nov 25, 2008 1:55 am
Posts: 1
Location: mumbai
just check the hibernate mapping dtd in u r hibernate jar file ,is there any string like callable is there or not,i am sure u r using old hibernate jar file ,plase update with lattest jar ,i hope this will resolve u r problem

_________________
srinibasv


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