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: Components and CriteriaAPI
PostPosted: Mon Nov 03, 2008 11:40 am 
Beginner
Beginner

Joined: Tue Dec 04, 2007 4:48 pm
Posts: 21
Hi,

I have an entity, which has a list of "lines" which are mapped as components:

Code:
<class name="User" table="Employee" mutable="false">
    <id name="Id">
      <generator class="native"/>
    </id>
    <property name="Account"/>
    <set name="Lines" table="UserLine">
      <key column="UserId"/>
      <element column="LineName" type="string"/>
    </set>
</class>


so how can I select all linenames for a certain account using the criteria api? I tried

Code:
DetachedCriteria userLines = DetachedCriteria.For(typeof(User))
                .SetProjection(Projections.Property("Lines"))
                .Add(Expression.Eq("Account", userId));


but the resulting SQL looks like this:

Code:
SELECT this_0_.Id as y0_ FROM Employee this_0_ WHERE this_0_.Account = :p0); :p0 = 'domain\a'
[/code]

_________________
Please rate if the answer was helpful


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.