-->
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.  [ 3 posts ] 
Author Message
 Post subject: where clause
PostPosted: Fri Oct 29, 2004 9:23 am 
Newbie

Joined: Thu Sep 18, 2003 3:34 am
Posts: 9
in where clause expressions one should use property names, not column names? am i right? then why query "byUserUID" in this mapping does not work? it throws "unknown column userUID"... i'm using hibernate 2.1.6

Code:
<hibernate-mapping
>
    <class
        name="pl.iteam.nos.service.notification.model.Subscription"
        table="notification_Subscription"
        dynamic-update="false"
        dynamic-insert="false"
        select-before-update="false"
        optimistic-lock="version"
    >

        <id
            name="id"
            column="ID_Subscription"
            type="java.lang.Long"
        >
            <generator class="native">
            </generator>
        </id>

        <discriminator
            column="type"
            type="string"
            length="1"
        />

        <subclass
            name="pl.iteam.nos.service.notification.model.GroupSubscription"
            dynamic-update="false"
            dynamic-insert="false"
            discriminator-value="G"
        >
        <property
            name="groupId"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="subscriberId"
        />
        </subclass>
        <subclass
            name="pl.iteam.nos.service.notification.model.PersonalSubscription"
            dynamic-update="false"
            dynamic-insert="false"
            discriminator-value="P"
        >
        <property
            name="userUID"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="subscriberId"
        />

        </subclass>

    </class>

        <query name="byUserUID"><![CDATA[
            from PersonalSubscription where userUID = ?
        ]]></query>

</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 29, 2004 12:04 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
from PersonalSubscription p where p.userUID = ?

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 02, 2004 5:00 am 
Newbie

Joined: Thu Sep 18, 2003 3:34 am
Posts: 9
thanks, i always forget about aliases. but just of curiosity - why this one works?:

from PersonalSubscription where subscriberId = ?

?


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