Hi,

the best practice is to use an object relational mapping library to
avoid disseminating sql statements inside your templates. Also, updates
to the database should be performed by a controller and not from inside
the templates.

I agree with you that Hibernate is overkill in many situations, and
that's why I initially started the Velosurf project. Maybe it can
fulfill your needs.

http://velosurf.sourceforge.net

the 2.2 release should be published quite soon, so I invite you to use
the svn head rather than the 2.1 release if you want to go further than
testing it. Feedback is welcome.

There are also some other persistence and o/r mapping libraries besides
Hibernate you may want to check: iBatis, jGrinder, dmLite, Melati,
Cayenne, TinyMarbles, Odal, Carbonado, SimpleORM... 


  Claude


Le vendredi 13 juillet 2007 à 17:38 +1000, Joe Kramer a écrit :
> Hello,
> 
> I need to compile templates based on database ResultSet rows.
> 
> I have application properties, something like
>   database.statement=SELECT name,surname FROM user
>   template.name=sometemplate.vm
> 
> sometemplate.vm:
>   <body>Hello $db.firstname $db.surname !</body>
> 
> Java meta-code:
>   conn = DriverManager.getConnection(...)
>   result = statement.executeQuery(<statement from properties above>);
>   while (result.next()) {
>     context=SomeMagicClassThatWillMergeResultToContext.mergeRow(result);
>     template= template = Velocity.getTemplate(<template from properties>);
>     template.merge(context, writer);
>   }
> 
> My question: is there any simple solutions to map DB ResultSet into
> context or HashMap (without involving complex J2EE
> stuff/Spring/Hibernate)?
> What is the best practice anyway?
> 
> Thanks.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to