When you instruct XDoclet to create a value object when you write an entity bean, e.g.

@ejb.value-object name="MyBean" match="*"

The generated CMP will contain a get method for getMyBeanValue().

You would still need to put that method in your bean, e.g.

public abstract some.package.MyBeanValue getMyBeanValue();

and then put the xdoclet tags to expose it as an interface method.

Further, it you want to have a set method exposed to the client, put the abstract setter in your bean class as well.

On additional Caveat, I noticed that if I have an attribute that only has a get method (no set implemented, a read only property) and put the ejb.value-object tag on that get property, then the ValueObject correctly only has a get method in it, and it can be set by using the constructor only.  Unfortunately, the generated cmp/bmp impl class ignores this property (because it sets each property rather than use the constructor impl).

ALSO, I wanted to make sure I could insert behavior around all this, so as a place holder, I expose a method like:

public some.package.MyBeanValue getMyBeanVO();

So, the interface method has getMyBeanVO rather than MyBeanValue.. this allows me to insert have more control over the lifecycle of hte VO, and I can repair the value object in my own VO method if I have read only properties.  As a note - I expected that the cmp or bmp imp will eventually fix this problem for read only properties.

Hope that gives you enough info to go on.

JS



 

>From: J Cameron Cooper <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: [Xdoclet-user] generated BeanNameCMPs
>Date: Thu, 12 Jun 2003 18:26:32 -0500
>
>Someone recently posted a little info on how the generated *CMP
>classes worked (I think) but I promptly deleted it and can't find it
>on the archives. Turns out I needed that later in the day.
>
>Could that (or a pointer to it) come back for a bit? And if it
>doesn't say how one might use the *CMP's facilities to get an EJB's
>data/value object, might someone enlighten me on that as well? Seems
>like a simple thing to do, but I apparently just don't Get It.
>
> --jcc
>
>
>
>-------------------------------------------------------
>This SF.NET email is sponsored by: eBay
>Great deals on office technology -- on eBay now! Click here:
>http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
>_______________________________________________
>xdoclet-user mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/xdoclet-user


Protect your PC - Click here for McAfee.com VirusScan Online ------------------------------------------------------- This SF.NET email is sponsored by: eBay Great deals on office technology -- on eBay now! Click here: http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to