You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Patrick Tonidandel <pa...@wuerth.it> on 2001/11/29 17:21:05 UTC
unsteady behaviour in Source generation
Dear gentlemen,
i noticed that velocity does not generate all the line that it finds in the
template files (*.vm).
In other words. The template Peers.vm contains the definition of the methods
doInsert(Criteria) and
doInsert(Criteria, DbConnection) .
The last line of this methods (--> return BasePeer.doInsert( criteria,
dbCon ); ) will not be generated in the BaseMYOBJECTPeer.java file by
Velocity.
If i insert a empty line before this line like this :
----------------------------------------------------------------------- CODE
public static ObjectKey doInsert( Criteria criteria, DBConnection
dbCon )
throws Exception
{
#if ( $table.Database.Name != "default" )
criteria.setDbName(mapBuilder.getDatabaseMap().getName());
#end
#foreach ( $col in $table.Columns )
#set ( $cup=$col.Name.toUpperCase() )
#if ( $col.isBooleanInt() )
// check for conversion from boolean to int
if ( criteria.containsKey($cup) )
{
Object possibleBoolean = criteria.get($cup);
if ( possibleBoolean instanceof Boolean )
{
if ( ((Boolean)possibleBoolean).booleanValue() )
{
criteria.add($cup, 1);
}
else
{
criteria.add($cup, 0);
}
}
}
#elseif ($col.isBooleanChar())
// check for conversion from boolean to Y/N
if ( criteria.containsKey($cup) )
{
Object possibleBoolean = criteria.get($cup);
if ( possibleBoolean instanceof Boolean )
{
if ( ((Boolean)possibleBoolean).booleanValue() )
{
criteria.add($cup, "Y");
}
else
{
criteria.add($cup, "N");
}
}
}
#end
#end
## <--- insert empty line here--->
return BasePeer.doInsert( criteria, dbCon );
}
----------------------------------------------------------------------------
---- CODE
Now Velocity generates the doInsert()-methods of BaseMYOBJECTPeer.java -
files in the correct manner.
Why do I have to insert such empty lines in the templates to get a correct
generation?????
P.S. I'm using velocity-1.2-rc2.jar .
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>