ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: abator and class hierarchy
Date Tue, 01 Jul 2008 18:36:50 GMT
You could use iBATIS' ResultObjectFactory.  When iBATIS asks for a new
com.test.model.abator.Thing, you could return com.test.model.Thing.

Jeff Butler

On Tue, Jul 1, 2008 at 1:16 PM, David Evans <dsevans@berndtgroup.net> wrote:

> Hello,
> Apologies, This post is slightly off topic, as it has to do with java
> class hierarchy, but i'm hoping someone here will have solved the same
> problem.
> I have set up abator to create my sqlmaps, model and spring dao classes.
> I would like to use these generated model classes as base classes for
> more fully featured business objects. my situation looks like this:
> com.test.model.abator.Thing (generated by abator)
> com.test.model.Thing extends com.test.model.abator.Thing
> Now my Thing model never has to worry about the field getters and
> setters mirroring the database table.
> When using the dao classes, i have a problem. For updates and inserts,
> everything is fine, i can pass the com.test.model.Thing to the dao and
> it accepts it of course, because it extends com.test.model.abator.Thing.
> but on a select the dao returns me a com.test.model.abator.Thing, which
> I cannot cast to a com.test.model.Thing. I can't think of a way to
> create a new com.test.model.Thing from a com.test.model.abator.Thing
> without duplicating all of the fields. If i have to create a constructor
> which explicitly transfers all of the field values then i lose the
> entire point of my abator setup.
> Thanks,
> Dave

View raw message