-->
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: sql-query in the mapping file
PostPosted: Thu Sep 04, 2003 9:27 am 
Newbie

Joined: Thu Sep 04, 2003 9:20 am
Posts: 3
Using Hibernate-2.1 Beta 1, I tried to define a named sql query
in the mapping file with a sql-query element.

There were two problems with this.

1. http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd
doesn't deifne this element and as a result fails to validate the
document. I couldn't find a 2.1 dtd anywhere in the installation base.

2. I'm getting an error at run-time, the error happens during the
parsing of the xml, also a result of the above.

Is this not an intended use of SQL queries? I know they can be
created dynamically from the Session, however it seems that what
I'm trying to do should work as well.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 04, 2003 10:16 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
The DTD most definitely does include a query element. Maybe you can include the snippet of the xml file where you are trying to attempt this? Then we can show you what you are doing incorrectly.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 04, 2003 10:32 am 
Newbie

Joined: Thu Sep 04, 2003 9:20 am
Posts: 3
Yes, it does define a query element, however, I'm trying to use
native sql query instead.
Here's a snippet.

<hibernate-mapping auto-import="true">

<class name="MyClass" table="MY_TABLE">
...
</class>

<sql-query name="myQuery">
<return alias="c" class="MyClass"/>
SELECT {c}.ID AS {c.id}
FROM MY_TABLE {c}
</sql-query>

</hibernate-mapping>

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 04, 2003 10:59 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is not yet implemented. Check the Road Map.


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.