-->
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: Anfrageproblem mit 1:n Beziehung
PostPosted: Mon Sep 25, 2006 9:55 am 
Beginner
Beginner

Joined: Thu Aug 31, 2006 7:41 am
Posts: 24
Hi,

habe ein kleines Problem mit einer Anfrage.

Vorrausgesetzt sei folgende Beziehung:
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">
<!-- Generated 24.08.2006 13:32:08 by Hibernate Tools 3.1.0.beta5 -->
<hibernate-mapping>
    <class name="de.zgdv.rostock.ceismedia.hibernate.Media" table="media">
        <comment></comment>
        <id name="id" type="int">
            <column name="id" />
            <generator class="native" />
        </id>
        <many-to-one name="derivedFrom" class="de.zgdv.rostock.ceismedia.hibernate.Media" fetch="select">
            <column name="Derivative_id">
                <comment></comment>
            </column>
        </many-to-one>
<property name="revision" type="int">
            <column name="revision" not-null="true">
                <comment></comment>
            </column>
        </property>
        <set name="revisions" inverse="true" cascade="persist,merge,save-update">
            <key>
                <column name="Revision_id">
                    <comment></comment>
                </column>
            </key>
            <one-to-many class="de.zgdv.rostock.ceismedia.hibernate.Media" />
        </set>
    </class>
</hibernate>


Ich moechte nun in einer Anfrage alle Media Elemente aus der Datenbank lesen, wobei aber jeweils nur die hoechste Revision in die Ausgabe uebernommen werden soll.

Leider bekomme ich dafuer weder eine HQL noch eine SQL Anfrage zusammen. Geht das ueberhaupt?

Andreas


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.