I'm looking at improving the DAO stuff for BMP entity
beans, in particular, I'm thinking of making it work
more like the dataobjects. Specifically:
- adding a template and/or subtask for generating the
DAO interfaces (CustomerDAO.java in the samples), with
an @ejb:dao class level tag in the bean class to
control its generation. You then code the DB-specific
subclasses for these (CustomerExampleDAO.java),
inheriting from them. (to avoid compilation errors in
your subclasses when new dao methods are added,
perhaps the template should generate an abstract class
with empty methods (or ones that throw an SQL
exception) rather than an interface?
- in the BMP template, it can check for whether a DAO
is being used (similar to ifIsWithDataContainer) and
automatically add the calls to the DAO into the
generated ejbLoad etc. rather than having to code it
in the bean class like CustomerBMPBean.java does.
- the @ejb:dao tag can specify the env-entry to use
for looking up the actual class, so we don't need to
include getDAO() with an @ejb:dao-method tag in the
- in fact, this means all mention of the dao can be
removed from the bean class. So you could then switch
from using BMPs with DAOs to CMP without changing any
code, just switch the tag to @ejb:bean type="CMP"
- and, ideally, it'll work with the "component
inheritence" so I can have all my entity EJBs inherit
from an abstract superclass, and using DAOs that
inherit from an abstract DAO (with the PK and findAll
finders being declared in the abstract DAO superclass).
Any comments/suggestions/improvements? (especially
from Vincent, since he checked in the existing bits)