Thanks Dude !
1. JPA Sucks.
1. JPA Sucks.
2. HQL works :
Session session = (Session) entityManager.getDelegate();
Criteria criteria = session.createCriteria(Design.class);
Query query = session.createQuery("select d from Design d join d.tags t where t.name in (:tags) group by d having count(t) =:tag_count");
query.setParameterList("tags",tags);
query.setInteger("tag_count",tags.length);
List<Design> list = query.list();
3. Hibernate without HQL doesn't work :
/* int i=0;
for ( String tagName : tags ) {
String aliasName = "alias_" + i;
criteria.createAlias("tags", aliasName, Criteria.INNER_JOIN);
criteria.add( Restrictions.eq(aliasName+".name",tagName) );
i++;
}*/
// List<Design> list = criteria.list();
4. PHP and MySql Rock.
No comments:
Post a Comment