-->
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.  [ 1 post ] 
Author Message
 Post subject: Request not right
PostPosted: Tue Jul 27, 2004 9:03 am 
Newbie

Joined: Tue Jul 27, 2004 7:43 am
Posts: 3
I use a file xml to question a table :



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.oreilly.hh.Track" table="TRACK">
<meta attribute="class-description">
Represents a single playable track in the music database.
@author Jim Elliott (with help from Hibernate)
</meta>
<id name="id" type="int" column="TRACK_ID">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>
<property name="title" type="string" not-null="true"/>
<property name="filePath" type="string" not-null="true"/>
<property name="playTime" type="time">
<meta attribute="field-description">Playing time</meta>
</property>
<set name="artists" table="TRACK_ARTISTS" lazy="true">
<key column="TRACK_ID"/>
<many-to-many class="com.oreilly.hh.Artist" column="ARTIST_ID"/>
</set>
<property name="added" type="date">
<meta attribute="field-description">When the track was created</meta>
</property>
<property name="volume" type="short">
<meta attribute="field-description">How loud to play the track</meta>
</property>
<set name="comments" table="TRACK_COMMENTS">
<key column="TRACK_ID"/>
<element column="COMMENT" type="string"/>
</set>
<list name="tracks" table="ALBUM_TRACKS">
<key column="ALBUM_ID"/>
<index column="POSIT"/>
<many-to-many class="com.oreilly.hh.Track" column="TRACK_ID"/>
</list>
</class>
<query name="com.oreilly.hh.tracksNoLongerThan"><![CDATA[
from com.oreilly.hh.Track as track
where track.playTime <= :length
]]></query>
<query name="com.oreilly.hh.tracksNoLongerThan2"><![CDATA[
select track.title from com.oreilly.hh.Track as track
where track.playTime <= :length
]]></query>
</hibernate-mapping>

but when I use the request "com.oreilly.hh.tracksNoLongerThan" with the code :

Query query = session.getNamedQuery("com.oreilly.hh.tracksNoLongerThan");
query.setTime("length", length);
return query.list();


it turns over me a list taking again all the recordings of the table without holding account of the criterion. The criterion "length" is well of the same type of the fields of the table

Could you help me[code][/code]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.