Couple of questions

3 views
Skip to first unread message

sproket

unread,
Oct 21, 2007, 5:52:43 PM10/21/07
to Persist
This is a very cool project. I love it. So simple.

A couple of questions:

I notice that boolean fields don't work unless I use the 'get'
convention as opposed to the 'is' convention. Any reason for that?
I looked at the code. In the Mapping class getFieldsMaps method you
can add an extra check for this.

final String suffix;
if (name.startsWith("is")) {
suffix = name.substring(2);
} else {
suffix = name.substring(3);
}

and

if (name.startsWith("get") || name.startsWith("is")) {
getterSetter[0] = method;
} else if (name.startsWith("set")) {
getterSetter[1] = method;
}


which should cover it.

Also, why do you have annotations on the methods? Can we not make the
annotations work on the fields instead?

Thanks. Great work!

julio

unread,
Oct 21, 2007, 7:42:34 PM10/21/07
to Persist, spr...@videotron.ca
Hi,

Thanks for the feedback! These are actually known issues. Your
suggestions are in my plans for the next version (1.2). My idea is to
use a subset of the JPA annotations as opposed to the current
annotations. This means moving to field-based annotations as opposed
to getter/setter based ones. It's going to force a little bit of
refactoring on existing code that use Persist, but I think it's for a
good cause. Besides, the boolean is-getter is actually bugging me for
some time, I just didn't have enough time in the last few weeks to fix
it using field-based annotations (which involve doing some major
changes in the getter/setter introspection, adding test cases for
booleans, retesting against all supported databases, and so on).

Please let me know if there are any issues you found that could
improve this library. I hope it can be helpful for you.

Julio

Reply all
Reply to author
Forward
0 new messages