Michael Harm
2003-10-18 18:48:02 UTC
Hi again.
I've been using dataobjects with middlegen/ejbdoclet (jboss 3.2.1,
oracle 9i), but I find that often in my session beans I'd like to be
able to optionally stick in references to other data objects that have
an fk relationship to my object. For instance, if a Person bean has a
set of related Address beans, I'd like it to not only have the field in
AddressData for the person pk, but also a PersonData member. When I
need to slap that in, I can, (thereby making a 'heavy' dataobject), or
optionally not (for a 'light' one).
Value objects in xdoclet/ejbdoclet seem the thing to use. But I'm
having a hard time integrating the standard middlegen stuff with that.
ejbdoclet wants @ejb.value-object tags in the comments for cmr fields
to create the objects; otherwise I just get the column fields and
that's no better than what the dataobject guy gives me. But middlegen
doesn't seem to want to create these tags for the cmr objects (like, in
the comments above the generated 'getFooByBarId' things in the entity
bean). I can make merged files for the column field accessors, but it
doesn't end up in the object reference accessors like 'getFooByBarId'.
I tried hacking the velocity template to stick 'em in there, and told
the valueobject directive in ejbdoclet to suffix them with "Data" and
not "Value", and that compiles, but the resultant value objects have
references to Local beans, not other value objects. In other words, my
AddressData guy has members like PersonLocal, not PersonData. Which
means I can't use them outside a transaction context, which is the
whole reason I want to use value/data objects in the first place.
So there's probably something very simple that I'm missing here.
I understand that the whole value object thing is undergoing a major
refactoring, and there's an effort to replace dataobjects with
valueobjects entirely. What's the status of that? Is there a pointer
to info about it? The user mailing list has only a couple references
to it. Is that the animal I want to be looking at? Should I check out
that branch in cvs, or is it still undergoing major development?
Or should I just try my hand at butchering xdoclet's template for data
objects to make it also include private fields, getters and setters for
referenced objects (like PersonData in the example above), and call it
a day? Pretend that I never heard about value objects, and instead
have it generate extended data objects?
Thanks for any info!
cheers,
Mike Harm
I've been using dataobjects with middlegen/ejbdoclet (jboss 3.2.1,
oracle 9i), but I find that often in my session beans I'd like to be
able to optionally stick in references to other data objects that have
an fk relationship to my object. For instance, if a Person bean has a
set of related Address beans, I'd like it to not only have the field in
AddressData for the person pk, but also a PersonData member. When I
need to slap that in, I can, (thereby making a 'heavy' dataobject), or
optionally not (for a 'light' one).
Value objects in xdoclet/ejbdoclet seem the thing to use. But I'm
having a hard time integrating the standard middlegen stuff with that.
ejbdoclet wants @ejb.value-object tags in the comments for cmr fields
to create the objects; otherwise I just get the column fields and
that's no better than what the dataobject guy gives me. But middlegen
doesn't seem to want to create these tags for the cmr objects (like, in
the comments above the generated 'getFooByBarId' things in the entity
bean). I can make merged files for the column field accessors, but it
doesn't end up in the object reference accessors like 'getFooByBarId'.
I tried hacking the velocity template to stick 'em in there, and told
the valueobject directive in ejbdoclet to suffix them with "Data" and
not "Value", and that compiles, but the resultant value objects have
references to Local beans, not other value objects. In other words, my
AddressData guy has members like PersonLocal, not PersonData. Which
means I can't use them outside a transaction context, which is the
whole reason I want to use value/data objects in the first place.
So there's probably something very simple that I'm missing here.
I understand that the whole value object thing is undergoing a major
refactoring, and there's an effort to replace dataobjects with
valueobjects entirely. What's the status of that? Is there a pointer
to info about it? The user mailing list has only a couple references
to it. Is that the animal I want to be looking at? Should I check out
that branch in cvs, or is it still undergoing major development?
Or should I just try my hand at butchering xdoclet's template for data
objects to make it also include private fields, getters and setters for
referenced objects (like PersonData in the example above), and call it
a day? Pretend that I never heard about value objects, and instead
have it generate extended data objects?
Thanks for any info!
cheers,
Mike Harm