-->
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: error BasicPropertyAccessor - expected type: java.lang.Strin
PostPosted: Thu Apr 22, 2010 2:34 pm 
Newbie

Joined: Thu Apr 22, 2010 2:25 pm
Posts: 6
I am getting following error for my code

BasicPropertyAccessor - expected type: java.lang.String, actual value: java.lang.Character

MyBean
Code:
public class GuestLog
{
private java.lang.String rESNO ;
private java.lang.Integer aGENTID ;
public void setRESNO (java.lang.String _rESNO )
{
this.rESNO = _rESNO;
}
public java.lang.String getRESNO ()
{
return this.rESNO ;
}

public void setAGENTID (java.lang.Integer _aGENTID )
{
this.aGENTID = _aGENTID;
}

public java.lang.Integer getAGENTID ()
{
return this.aGENTID ;
}

}


My SQL Statement
Code:
StringBuilder hsql = new StringBuilder(
      "SELECT rESNO as RESNO , aGENTID as AGENTID from mytable");

SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(
            hsql.toString());
query.setResultTransformer(Transformers.aliasToBean(GuestLog.class));
List<GuestLog> result = query.list();



As soon as i add following, the query works
Code:
query.addScalar("RESNO", Hibernate.STRING);
query.addScalar("AGENTID ", Hibernate.INTEGER);


I really dont like this idea of adding scalar to all the columns, any work arounds


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.