hi!
could anyone give me an exapmle of how to use the exists - criteria. i 
tried to implement a join with that. my situtation is:

object user
object course
object user_course

now i want to get the number of courses, a specific user has access to. 
the courses also have to match a pattern.

now i tried something like (code is simplified):

            Criteria crit = new Criteria();

            crit.addEqualTo( "userOid", userOid );
            Query mtonQuery = new QueryByCriteria( User_Course.class, crit 
);

            crit = new Criteria();
            crit.addExists( mtonQuery );

            final Timestamp currentTime = new Timestamp( 
System.currentTimeMillis() );
            crit.addLessThan( "beginTimestamp", currentTime);
            crit.addGreaterOrEqualThan( "endTimestamp", currentTime);

            Query courseQuery = new QueryByCriteria( Course.class, crit, 
true );

            PersistenceBroker.getCount( courseQuery );

the problem is, that there is a error in sql generation, but i don't know 
if i just don't use the criteria correctly.

please help.

juergen

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to