You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Claude <cl...@savoirweb.com> on 2002/04/22 03:31:47 UTC

Velosurf - a db tool for velocity

Hi folks...

I'd like to share a Velocity db tool that I wrote.

The tarball is for now (temporarily ?) hosted at sourceforge, but I would of course prefer to see it hosted at jakarta.
Although there are some code homogeneization to be achieved here and there before thinking of it (see TODO.txt), I'd be glad to see
it admitted for inclusion in the veltools subproject in a near future.

http://velosurf.sourceforge.net/velosurf-0.2.tgz (~172k)

Please let me now of your questions, remarks...

CloD

----- Here is an extract of the README file :

WHAT IS IT ?

Velosurf is a - thin but efficient - database abstraction layer meant to be use
with Velocity (http://jakarta.apache.org/velocity/index.html), written in Java.
Current version is 0.2 : still quite early in the development process, still some
imperfections, but the package is already functionnal.

The aim of Velosurf is to provide template writers a set of context variables that
automatically map database tables and relationships.

WHY VELOSURF ?

Mainly, to avoid rewriting each time specific database mapping layers in each project involving
velocity and database entities that template writers have to deal with.

----- And here is some sample VTL code using velosurf :

## "Out of the box" usage :

Workers :
#foreach ($worker in $db.worker)
    Name : $worker.firstname $worker.lastname
        position : $db.position.fetch([$worker.position_id]).name
        boss : $db.worker.fetch([$worker.boss_id]).lastname
#end

## when defining foreign keys in a .def file as follow :
##    worker.boss = worker(boss_id)
##    worker.position = position(position_id)
## or directly in the template as follow :

#set ($db.worker.boss = "worker(boss_id)")
#set ($db.worker.position = "position(position_id)")

## the preceding example can be rewritten as :

Workers :
#foreach ($worker in $db.worker)
    Name : $worker.firstname $worker.lastname
        position : $worker.position.name
        boss : $worker.boss.lastname
#end




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>