-->
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: Issue bean setter with column width is 1 char on DB2/400
PostPosted: Wed Nov 30, 2011 2:49 pm 
Newbie

Joined: Thu Apr 22, 2010 2:25 pm
Posts: 6
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


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.