Not sure if this will be useful to others but I was looking around the whole day why there is no match between the username. Turns out firebird doesn't return string that is trim when calling rs.getString
//previously
pObject.setUserName(rs.getString(3));
//after edit will generate the following
pObject.setUserName((rs.getString(3)).trim());
xManagerTemplate.vm
-----------------
//72
public $beanClass decodeRow(ResultSet rs) throws SQLException
{....
Thanks, it might help others. Note that we do not prefer to trim the string at this level, inserting space might be done on purpose: (in password etc...).
Be careful, your patch is dangerous as getString could return null => nullpointerexception.
N.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks, noted that the "standard" way of sql2java will not trim at this level
will revert to calling trim when accessing each string field
Is there be a common way of sorting eg. when using loadAll?
a update(included check for null) for those who are still interested in deviatating from the common way of sql2java
---------
//72
public $beanClass decodeRow(ResultSet rs) throws SQLException
{
$beanClass pObject = create$beanClass();
String tmpStr;
## the set statement casts $velocityCount to a string
#foreach ( $column in $columns )
#set ($vCount = "$velocityCount" )
//pObject.$strUtil.getSetMethod($column)($column.getResultSetMethodObject($vCount));
#if ($column.getResultSetMethodObject($vCount) == "rs.getString($vCount)")
tmpStr = $column.getResultSetMethodObject($vCount);
if (tmpStr != null)
pObject.$strUtil.getSetMethod($column)(tmpStr.trim());
else
pObject.$strUtil.getSetMethod($column)(tmpStr);
#else
pObject.$strUtil.getSetMethod($column)($column.getResultSetMethodObject($vCount));
#end
#end
pObject.isNew(false);
pObject.resetIsModified();
return pObject;
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Not sure if this will be useful to others but I was looking around the whole day why there is no match between the username. Turns out firebird doesn't return string that is trim when calling rs.getString
//previously
pObject.setUserName(rs.getString(3));
//after edit will generate the following
pObject.setUserName((rs.getString(3)).trim());
xManagerTemplate.vm
-----------------
//72
public $beanClass decodeRow(ResultSet rs) throws SQLException
{....
// pObject.$strUtil.getSetMethod($column)($column.getResultSetMethodObject($vCount));
#if ($column.getResultSetMethodObject($vCount) == "rs.getString($vCount)")
pObject.$strUtil.getSetMethod($column)(($column.getResultSetMethodObject($vCount)).trim());
#else
pObject.$strUtil.getSetMethod($column)($column.getResultSetMethodObject($vCount));
#end
....}
Hi,
Thanks, it might help others. Note that we do not prefer to trim the string at this level, inserting space might be done on purpose: (in password etc...).
Be careful, your patch is dangerous as getString could return null => nullpointerexception.
N.
Thanks, noted that the "standard" way of sql2java will not trim at this level
will revert to calling trim when accessing each string field
Is there be a common way of sorting eg. when using loadAll?
a update(included check for null) for those who are still interested in deviatating from the common way of sql2java
---------
//72
public $beanClass decodeRow(ResultSet rs) throws SQLException
{
$beanClass pObject = create$beanClass();
String tmpStr;
## the set statement casts $velocityCount to a string
#foreach ( $column in $columns )
#set ($vCount = "$velocityCount" )
//pObject.$strUtil.getSetMethod($column)($column.getResultSetMethodObject($vCount));
#if ($column.getResultSetMethodObject($vCount) == "rs.getString($vCount)")
tmpStr = $column.getResultSetMethodObject($vCount);
if (tmpStr != null)
pObject.$strUtil.getSetMethod($column)(tmpStr.trim());
else
pObject.$strUtil.getSetMethod($column)(tmpStr);
#else
pObject.$strUtil.getSetMethod($column)($column.getResultSetMethodObject($vCount));
#end
#end
pObject.isNew(false);
pObject.resetIsModified();
return pObject;
}