-->
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: simple query syntax problem: entity not in entity.collection
PostPosted: Mon Aug 31, 2009 1:30 pm 
Newbie

Joined: Mon Aug 31, 2009 1:19 pm
Posts: 11
Hello, I have a query like this:
Code:
select e from MyEntity e where :otherEntity not in e.myCollection


But I cannot get it work. It throws an SQL syntax error.
Quote:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 1:


Here is the SQL as is shown by Hibernate:
Code:
    select
        myEntity0_.id as id12_,
        myEntity0_.nombre as nombre12_,
    from
        MyEntity myEntity0_,
        MyEntity_MyEntity myColl1_,
        MyEntity myEntity2_
    where
        myEntity0_.id= myColl1_.e1_id
        and myColl1_.e2_id=myEntity2_.id
        and (
            ? not in  (
                .
            )
        )

could anyone help me?

Regards,
Chiara


Top
 Profile  
 
 Post subject: Re: simple query syntax problem: entity not in entity.collection
PostPosted: Thu Oct 01, 2009 2:55 pm 
Newbie

Joined: Mon Aug 31, 2009 1:19 pm
Posts: 11
the solution is using elements:
Code:
select e from MyEntity e where :otherEntity not in elements(e.myCollection)


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.