ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Evans <dsev...@berndtgroup.net>
Subject abator and class hierarchy
Date Tue, 01 Jul 2008 18:16:06 GMT

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

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.



View raw message