-->
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.  [ 2 posts ] 
Author Message
 Post subject: Newbie: Many-to-Many HQL SELECT with LIKE on Collection
PostPosted: Tue Mar 14, 2006 6:39 am 
Newbie

Joined: Tue Mar 14, 2006 6:29 am
Posts: 1
Hi,

a simple newbie question for you :-).

I have the following mapping.

-------
<hibernate-mapping package="de.test.hibernate">
<class name="IfdmSysInt" table="IFDM_SYS_INT">
<id name="id" column="ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">A_SEQ</param>
</generator>
</id>
<property name="nameA" column="NAME_A" type="java.lang.String" />
<list name="tableBs" table="TABLE_AB" lazy="false" cascade="all-delete-orphan">
<key><column name="A_ID" not-null="true" /></key>
<index column="IDX" />
<many-to-many class="TableB">
<column name="B_ID" not-null="true" />
</many-to-many>
</list>
</class>
</hibernate-mapping>
----------

<hibernate-mapping package="de.test.hibernate">

<class name="tableB" table="TABLE_B">
<id name="id" column="ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">B_SEQ</param>
</generator>
</id>

<property name="name" column="NAME" type="java.lang.String" />
<list name="tableAs" table="TABLE_AB" inverse="true" lazy="true">
<key column="B_ID"/>
<index column="IDX" />
<many-to-many class="tableA" column="A_ID"/>
</list>

</class>

</hibernate-mapping>
---

And I like to do something like this with HQL:

"from tableA as a where tableBs.nameB like'%paul%'"

.. which doesn't work. How can I ask for elements in tableBs with name like xyz?

Regards,

Josh


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 14, 2006 10:40 am 
Beginner
Beginner

Joined: Tue Mar 14, 2006 10:00 am
Posts: 22
this should be work!

Code:
from tableA as a join tableBs as tabB with tabB.nameB like'%paul%


for more infos look at hibernate docu at page 142...

tom


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