Hi Mario :)

> > * The persisters extend EnhancedUserType, but they could extend
> > UserType (the extra methods are not used)
> >
> I am still not sure about it. The documentation of EnhancedUserType
> shows, that such types can be used as identifier or discriminator, so I
> assumed that this is not the case for simple UserTypes. I can't find
> anything more about it in the source code and it looks like the
> documentation is wrong here.
> Anyway, I don't understand why we should NOT use the EnhancedUserType,
> that way we can make use of the "to" and "from" string stuff hibernate
> will use for some xml magic.

Well, I also gave it some thought. If we are not providing a sensible
implementation for the XML mapping, I would better implement UserType
and anyone with a real XML need can extends this implementation,
implement EnhancedUserType and add all missing methods, and maybe
contribute it.

It seems that every type mapper in Hibernate is done with UserType, so
maybe EnhancedUserType is something prior-to-dinosaurs, when the
framework did not have a very clear objective; it could be imitating
CastorXML/CastorJDO in a swiss-army-knife, one-size-fits-all style.
Anyways this is not a big deal, implementing one interface or another.

> > * The implementation of each persister are very much the same, so they
> > could extend a single abstract class and add only a couple of methods.
> > The total code size shrinks to about 50%
> >
> Ok, ok, I know, I am lazy. Sorry for this. I'll have a look at it.

Lazy? Your implementation is great! I only added some tuning.

If you don't mind I will mail you offlist my three classes. Could
serve as a starting point, or just implement your own and compare.
Don't worry about dumping them all if they are not like what you had
in mind :)

Cheers.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to