-->
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: duplicate association path QueryException
PostPosted: Fri May 19, 2006 11:04 am 
Newbie

Joined: Fri May 19, 2006 10:49 am
Posts: 5
I'm getting the duplicate association path on the following search query:

...
rootCriteria = session.createCriteria(Entity.class);

rootCriteria.add(Restrictions.eq("entityTypeId", entityTypeId));
Criteria criteria2 = rootCriteria.createCriteria
("attributes","Attribute1");
criteria2.add(Restrictions.eq("entityAttributeTypeId",160004));
criteria2.add(Restrictions.eq("booleanValue",1));
matchedEntities = updateMatchedEntities(matchedEntities,
rootCriteria.list());

the call to list() results in the QueryException being thrown.

I don't see any relevant docs on the web, what am I likely doing wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 19, 2006 11:56 am 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
Code:
rootCriteria = session.createCriteria( Entity.class );
rootCriteria.add( Restrictions.eq( "entityTypeId", entityTypeId ) );
rootCriteria.createAlias( "attributes","Attribute1" );
rootCriteria.add(Restrictions.eq( "Attribute1.entityAttributeTypeId", new Long(160004) ));
rootCriteria.add(Restrictions.eq( "Attribute1.booleanValue", new Integer( 1 ) ) );
matchedEntities = updateMatchedEntities( matchedEntities, rootCriteria.list() );


I took the option of creating alias for attributes collection and assume entityAttributeTypeId, booleanValue are attributes in the collection element. Also I have placed wrappers Long, Integer for 160004 and 1 because without that you will get compile errors.


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.