http://stackoverflow.com/questions/36994153/boolean-value-not-getting-mapped-properly-in-hibernate-with-mysqlI am trying to map the result of an exists query(which returns TRUE/FALSE) from a mysql DB to a POJO via resultSetTransformer. I would hope the result of this exists query can get mapped to a boolean but it does not & throws below error :
Code:
.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of TestBean.value
The cause of this exception is shown as :
Code:
java.lang.IllegalArgumentException: argument type mismatch
Java Querying Code :
Code:
public class TestHibernate {
    private static SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
    public static void main(String[] args) throws ParseException{
        try{
            Query query = sessionFactory.openSession().createSQLQuery(""+
                    "select " +
                    " exists(select * from A where id = 3) as value"
                    );
            query.setResultTransformer(Transformers.aliasToBean(TestBean.class));
            List<TestBean> beanList = (List<TestBean>) query.list();
        }catch(Exception e){
            System.out.println(e);
        }
    }
}
The Pojo :
Code:
public class TestBean {
    private boolean value;
    public boolean isValue() {
        return value;
    }
    public void setValue(boolean value) {
        this.value = value;
    }
}
Am i missing something or is it a bug with hibernate or mySql JDBC Driver?
Hibernate version : 3.2.6GA Mysql JDBC Driver : mysql-connector-java-5.1.2