|
Hi,
We're trying to get XDoclet to build slightly
customised value objects without getting into writing our own, and we've got a
bit stuck.
What we have is an entity bean A related using CMR
to another entity bean B. The primary key of B is a URL, so the CMR relationship
uses this URL to relate an instance of A to the instance of B (many A to one
B).
What we want to be able to do is to create a value
object for an A bean on our web tier including (amongst other things) the URL to
the B bean that the A bean is related to, and use this value object to create a
new instance of A that is automatically related to the correct instance of B (as
identified by the URL in the value object). The B beans are all already set up,
so we can guarantee that the URL will be a valid foreign key.
The problem is, the URL foreign key isn't a CMP
field in A, it's a CMR-managed field. XDoclet therefore doesn't include it by
default in the value object it creates for A.
Even though the URL isn't strictly a field in A, it
effectively is (we're trying to hide the existence of B beans from our external
object model). Effectively there's a "derived" field in A that is the URL
foreign key to the related B. The B bean just contains more information about
the URL that isn't relevant in the normal course of things.
What we're wondering is: is there any way we can
tell XDoclet to include in the value object another field that is just the
literal foreign key for our CMR relationship? Or, alternatively, can we fill in
a field in the value object by dereferencing the CMR relationship and just
passing the URL extracted from the B bean at the far end?
If we can't solve this we either have to write our
own value objects or start passing B value objects around with the A ones,
neither of which is very attractive - so any help gratefully
received.
Cheers,
-- Simon and Brian
|
- RE: [Xdoclet-user] Value objects Brian McSweeney
- RE: [Xdoclet-user] Value objects Saripalli, Raju
- Re: [Xdoclet-user] Value objects Marcus Brito
