velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Tonidandel" <patrick.tonidan...@wuerth.it>
Subject unsteady behaviour in Source generation
Date Thu, 29 Nov 2001 16:21:05 GMT
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:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message