I have table with one column who length is 1 char, and in my bean i have configured this as String like below
Code:
Table Name
isactive char (1)
Bean
Code:
Name.java
private String isactive
//getter and setter here
when i try following SQL
Code:
SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(
Select isactive from NAME);
query.setResultTransformer(Transformers.aliasToBean(Name.class));
List<Name> result = query.list();
I get error in setting isactive for bean name
if i convert the SQL as below, it works
Code:
SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(
Select varchar(isactive) as isactive from NAME);
query.setResultTransformer(Transformers.aliasToBean(Name.class));
List<Name> result = query.list();
how to get it working without having to do this casting