Announcement Announcement Module
No announcement yet.
how can i use the "in" condition with HibernateTem Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • how can i use the "in" condition with HibernateTem

    I want to get the result of an SQL query like:
    select * from myTable where property in (my list).
    my problem is: how can i use the "in" condition with Hibernate.
    can i do it whith hibernatetemplate ?
    i try this code
    public class HibernateTransactionDao extends HibernateDaoSupport {
    public List findTransactionsToUpdate(String msisdns) 
    	throws DataAccessResourceFailureException, HibernateException, IllegalStateException {
    		Session session= getSession(true);
    		final List transactions=session.find("select tr from com.posanet.model.Transaction as tr where tr.msisdn in ('"+msisdns+"')");
            if (transactions.size() == 0) {
                return null;
            return transactions;
    this methode return my list, the list is not empty, so when i parse it, the objects are empty. all of property are null.

    sorry, i have a low level in "english".

  • #2
    Yes, you can use the HibernateTemplate or, if you want to do more work on the session and the HibernateTemplate API is not sufficient, use HibernateCallback.
    As for creating the HB query, read HB reference documentation as it includes excelent examples.