-->
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: HQL + Collections + one-to-many
PostPosted: Tue Sep 14, 2004 3:18 pm 
Newbie

Joined: Tue Sep 14, 2004 3:07 pm
Posts: 7
I have a trouble driving me crazy.

I have 2 objects:

Enterprises and Segments and a one-to-many relationship between them.

I have a primary key from a Segment (14) and need in just one step get all Entreprises with this segment.
I try a lot of thinks buy can not do that.

I need to filter some another properties of enterprise too.
I have now:

"select Enterprise from Enterprise in class adama.supplier.Enterprise " +
"where Enterprise.deleted != ? and ? in Enterprise.segments " +
"order by name",
{Boolean, Long}

segments is a List

Please, I really need some help.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 14, 2004 3:31 pm 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Well, if your really need our help, why not post your mapping documents. The red box you know.

HTH
Ernst


Top
 Profile  
 
 Post subject: XMLs
PostPosted: Tue Sep 14, 2004 3:50 pm 
Newbie

Joined: Tue Sep 14, 2004 3:07 pm
Posts: 7
Number 1: Sure
Number 2: Sorry. I am confusing, for now, and forget it. ;)
Number 3: Thanks a lot.


<hibernate-mapping>
<class
name="adama.supplier.SupplierSegment"
table="SupplierSegment"
>

<id
name="oid"
column="oid"
type="long"
>
<generator class="native">
</generator>
</id>

<property
name="descr"
type="java.lang.String"
column="descr"
/>

<property
name="name"
type="java.lang.String"
column="name"
/>

<property
name="status"
type="int"
column="status"
/>

<bag role="suppliers" table="SupplierSegmentEnterpriseXref">
<key column="segment"/>
<many-to-many column="enterprise" class="adama.supplier.Enterprise"/>
</bag>

</class>

</hibernate-mapping>

<hibernate-mapping>
<class
name="adama.supplier.Enterprise"
table="Enterprise"
>

<id
name="oid"
column="oid"
type="long"
>
<generator class="native">
</generator>
</id>

<property
name="name"
type="java.lang.String"
column="name"
/>

<property
name="descr"
type="java.lang.String"
column="descr"
/>

<property
name="cnpj"
type="java.lang.String"
column="cnpj"
/>

<property
name="ie"
type="java.lang.String"
column="ie"
/>

<property
name="im"
type="java.lang.String"
column="im"
/>

<property
name="status"
type="int"
column="status"
/>

<property
name="supplier"
type="boolean"
column="supplier"
/>

<property
name="deleted"
type="boolean"
column="deleted"
/>

<property
name="fantasy"
type="java.lang.String"
column="fantasy"
/>

<property
name="email"
type="java.lang.String"
column="email"
/>

<property
name="website"
type="java.lang.String"
column="website"
/>

<property
name="obs"
type="java.lang.String"
column="obs"
/>

<property
name="address"
type="java.lang.String"
column="address"
/>

<property
name="addressType"
type="int"
column="addressType"
/>

<property
name="addressNumber"
type="int"
column="addressNumber"
/>

<property
name="complement"
type="java.lang.String"
column="complement"
/>

<property
name="zip"
type="java.lang.String"
column="zip"
/>

<property
name="city"
type="java.lang.String"
column="city"
/>

<property
name="county"
type="java.lang.String"
column="county"
/>

<many-to-one
name="state"
class="com.md5.geo.State"
cascade="none"
outer-join="auto"
column="state"
/>

<many-to-one
name="country"
class="com.md5.geo.Country"
cascade="none"
outer-join="auto"
column="country"
/>

<property
name="client"
type="boolean"
column="client"
/>

<bag role="segments" table="SupplierSegmentEnterpriseXref">
<key column="enterprise"/>
<many-to-many column="segment" class="adama.supplier.SupplierSegment"/>
</bag>

<bag role="contacts" table="EnterpriseContactXref">
<key column="enterprise"/>
<many-to-many column="person" class="adama.sell.Person"/>
</bag>

</class>

</hibernate-mapping>


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.