You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Alessandro Colantoni <al...@gmail.com> on 2006/03/16 18:46:16 UTC

Mandragora make OJB easier

Hi all!
mandragora is a very small open source project available at
http://mandragora.sourceforge.net
With mandragora you are provided with the most common queries you use to
build with ojb.
How many times you wrote methods to find an object or a collection of
objects satisfying some conditions, warring about looking for persistence
broker, building a Criteria, managing rollback and exceptions to do
essentially always the same things?
For example how many times you have to find a value object passing his
primary key?
Mandragora just have implemented many methods that execute queries.
Of course these methods are implemented using Ojb
You pass as parameter to these methods a value object, and or a class, and
or some fields, and or some conditions, and they do all the jobs utilizing
ojb persistence broker apis
If in your class you write

import it.aco.mandragora.bd.BD <http://it.aco.mandragora.bd.bd/>;
import it.aco.mandragora.common.ServiceLocator;
BD bd = ServiceLocator.getInstance
().getManagerBD("BDFactoryDefaultClass","StandardBDDefaultClass")

in bd you have available all these methods.

If you want to find an object of class Author by primary key where the key
is "manzoni" just write:
Author author= (Author )bd.findByPrimaryKey(Author.class,"manzoni");

if you want all authors having seconName="garcia" just do :
author = new Author();
author.setSecondName("garcia");
Collection authors = bd.findCollectionByTemplate(author);

If you want all authors
authors = bd.findCollectionByTemplate(new Author());
and so on.
Don't worry about open or close a persistence broker. Mandragora do it.
It's possible to have more complex query too.
Mandragora provides an easy extensible mechanism to add your own queries.

The implementation of these queries is in the class
it.aco.mandragora.dao.ojb.pb.OjbPbDAO.

If this idea is welcome I will be very happy if some experienced ojb
man took a look at this class to help  improving  it

I want to get the opportunity to thank Ojb team for the great job they do,
for the quality of their product and for the incredible support they give.

Thanks for the attention              Alessandro