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.  [ 1 post ] 
Author Message
 Post subject: stackoverflow problem on Hibernate
PostPosted: Fri Dec 12, 2008 5:29 am 
Newbie

Joined: Fri Dec 12, 2008 5:19 am
Posts: 1
When I using this code to get the data from DB. It will get stackoverflow problem.
Code:
result.addAll(getCurrentSession().createCriteria(User.class)
       .add(Restrictions.ilike("name", "tom", MatchMode.ANYWHERE))
       .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
       .list());


User is a class have a one to many relationship to 3 other class.

If I update the the code to this. It will not get the problem.
Code:
StringBuilder hql = new StringBuilder();
   hql.append("SELECT distinct user FROM ")
   .append(" User as user")
   .append("WHERE lower(user.name) = :name ");
getCurrentSession().createQuery(hql.toString())
    setString("name", "%"+s+"%").list();


Is anyone know what the problem is?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.