[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2524) Criteria query with collection of values (Set<java.lang.String>)

Olivier Jaquemet (JIRA) noreply at atlassian.com
Wed Feb 4 06:11:38 EST 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32306#action_32306 ] 

Olivier Jaquemet commented on HHH-2524:
---------------------------------------

Hello Marco,

I would like to perform exactly the same kind of query.
Did you find a solution or workaround to get this working ?

Thanks for your help.
Olivier

> Criteria query with collection of values (Set<java.lang.String>)
> ----------------------------------------------------------------
>
>                 Key: HHH-2524
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2524
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-criteria
>    Affects Versions: 3.2.2
>         Environment: Java VM    : 1.5.0_07
> DBMS	   : HSQLDB
> Hibernate: hibernate-3.2.2.ga
>            Reporter: marco molinari
>
> Hi to all,
> I have a problem with Criteria query on collection of values.
> Below I wrote a piece of java code and a piece of Person.hbm.xml.
> I want to search all persons with the email addresses containing character '@'.  
> I obtain an empty list of Person and the SQL created by Criteria seems not correct ( more or less  ... WHERE lower(PERSON_ID) ? ).
> I search information inside Hibernate site and Hibernate book but I didn't found the solution.
> public class Person
> {
>     private Long id;
>     private Set<String> emailAddresses = new HashSet();
>     public Set<String> getEmailAddresses()
>     {
>         return emailAddresses;
>     }
>     public void setEmailAddresses(Set<String> emailAddresses) {
>         this.emailAddresses = emailAddresses;
>     }
> }
> public static void main(String[] args)
> {
>     List<Person> list = session.createCriteria(Person.class)
>        .add( Restrictions.ilike( "emailAddresses", "@", MatchMode.ANYWHERE ) )
>        .list();    
> }
> Piece of Person.hbm.xml:
> <set name="emailAddresses" table="'PERSON_EMAIL_ADDR'" inverse="true">
>     <key column="'PERSON_ID'"/>
>     <element column="'EMAIL_ADDR'" type="java.lang.String" not-null="true"/>
> </set>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list