Jaqu work

8 views
Skip to first unread message

shai

unread,
Feb 6, 2010, 9:32:06 AM2/6/10
to H2 Database
I took a look at Jaqu and found very intuitive and easy to use.

The basic way to use Jaqu was to create an object which is a
descriptor of the result I'm looking for. This is good as long as the
descriptor holds simple fields (String and Number extensions...), If
you want to show a relationship it gets more complicated... Here is an
example of what I mean:

public class person{
public String id;
public String name:
public Phone phone;
...
}

public class phone {
public String id;
public String number
}

It would be nice to do this:

List<Person> result = db.from(new Person()).select();
for (Person r: result){
System.out.println(r.phone.number);
}

currently this is not supported. So it got me working....

Well, maybe I've taken this to a place where the original writer never
intended, but I have invested some time and now my version of jaqu
does the following:

1. support One2One, One2Many, Many2Many relationships (But only with
single primary keys for now), in select, insert, update & delete.
(O2M, M2M require asm.jar to work)
2. support transient fields (i.e field you don't want to work with
persistence)
3. Lazy loading of o2m, m2m relationships
4. writing an update like the following: db.from(p).set(p.name,
value).where(p.field).is(value).update();
5. writing a primaryKey select:
db.from(p).primaryKey().is(value).select();
6. support for connection pool to a single db. and set the commit
option...
7. added commit, rollback.

Now it is possible to use Jaqu both for simple queries and for working
with real data entities as light Persistence Framework (replacing JPA,
Hibernate and such). I also took care of the problem of object reentry
and working with entities in and out of db session. I have not tested
it much yet (but i will since I'm going to use it as my persistence
framework on a project I'm doing...) but from very light testing I did
it works...

Now, if any one is interested I'm willing to share the work...

Shai Bentin

unread,
Feb 6, 2010, 12:09:59 PM2/6/10
to H2 Database
BTW... A specific question to the original author... Is there any
particular reason why you chose not to use Annotations? In my work I
continued along the lines of your "define method" however in some cases
I think annotations can make our lives simpler...

Shai

Thomas Mueller

unread,
Feb 10, 2010, 2:30:11 PM2/10/10
to h2-da...@googlegroups.com
Hi,

> why no Annotations

For some features it can't be used, for example to define multi-column
indexes or constraints. in JPA you need to create 'composite key
classes' for that, while in JaQu you only need one line of (regular)
Java code.

> if any one is interested I'm willing to share the work

I would be interested!

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages