Value Objects still  relevant in EJB 2.0?

I came across the concept of using Value Objects to get better performance from EJBs as they reduce the number of remote calls to invoke to retrieve object property values.
However, with the introduction of LocalHome and Local interfaces for EJB 2.0, is it still useful to have value objects to pass data around, typically between EJBs and the Controller (typically servlets/JSPs or session beans that implement business logic)?

Not so fast.
I wouldn't be so quick to get rid of VOs simply because local interfaces exist now. Keep in mind that using local interfaces is not always the right answer to your problem (since there are still situations where the client and server are not co-located within a given VM).
Also, there are times when the brittleness of your API should be considered. If a method takes many parameters, it is often benificial to pass a single VO as a paramater rather than multiple individual parameters. This really comes into play when methods are modified to take different arguments (e.g. adding a new argument).
Consider a method on a bean used to update a student's records for example.public StudentVO update(String firstName, String middleInitial, String lastName, int age, String ssn, String status) throws UpdateException; is much more brittle than public StudentVO update(StudentVO student) throws UpdateException;Consider what would happen if a design change makes GPA and gradeLevel part of a student's profile.
The second method's signature would remain the same. The signature of the first method however would now read public StudentVO update(String firstName, String middleInitial, String lastName, int age, String ssn, String status, float gpa, int gradeLevel) throws UpdateException; This change would "break" the calls made by any callers of this method. While there are pros and cons to this (as well as other ways to solve this issue, such as method overloading, etc.), it is something to consider when deciding whether a value object should be used in certain situations.
Hope this adds another point of view to the discussion.
Note: I'm using Value Object (VO), Data Transfer Object (DTO) and Transfer Object (TO) to me the same thing here.

Similar Messages

  • Value Object Pattern - Does EJB 2.0 Deprecate?

    In the EJB 1.1 specification, there were no such things as Local Interfaces and Local Home Interfaces. In the Core J2EE Patterns book, they cite the main reason for using the Value Object Pattern as being a way to avoid much of the network overhead associated with using EJB; any call to an EJB potentially involves a remote call to the object even if it lives in the same JVM. But with EJB 2.0 you can have a Local Interface which seems to eliminate all this network overhead already.
    Anyone care to register an opinion on whether or not there are still valid reasons for implementing the Value Object Pattern when using EJB 2.0?
    Any input would be greatly appreciated!

    Yes - the fact that it's generally a bad idea to "tie" stateful information (e.g. EntityBeans) to a stateless front-end.
    In other words, it's better functionality to transfer "static" sets of data (Value Objects) in chunks from a business-layer (SLSBs, fronting the EntityBeans) than to have the front-end directly query the persistence tier. Also, using the Facade (and related) patterns as the go-between the view (front-end) layer and the persistence layer, you gain the flexibility of the persistence (and the business) layer changing without having to re-engineer the view at all.

  • Passing "Value Objects" from one JSP to next  (2)

              Someone posted a response from BEA which has since disappeared, it was no different
              from what I was doing and it I still can't get it to store the information in
              the Value Object.
              I get values (true/false) from a Radio button on a FORM in a JSP, press a "Next
              Step" Button.
              I have a "Value Object" in JSP_1, which I use the setters to store various information
              obtained from the <FORM>. I then "jsp:forward" to JSP_2, set different information
              and then I "jsp:forward" to JSP_3 & so on. At the end of the JSP chain only the
              last setter is has the value "true", all the other values are false, despite all
              being "set" to "true".
              The "Value Object" is not storing the information set in previous JSPs. When I
              initially create the "value object" I use;
              <jsp:useBean id="myVO" class="uk.co.notify.valueobjects.MyVO" scope="request"
              />
              <jsp:setProperty name="myVO" property="*"/>
              In JSP_2 JSP999 I don't use <jsp:setProperty> I let the setter in the VO do
              it.
              I am using WebLogic 6.1 sp2 under Windows 2K Pro.
              Any pointers. Thanks.
              [att1.html]
              

    Ok. here's the difference.
              Hitting submit is altogether a different "new" http request. It will send a
              new request from your browser to the server. Whereas, the jsp:forward is
              within the server itself.
              So the VO object whose scope is set to "request" will not retain its values
              between 2 http request.
              For such kind of parameter passing, you could very well store the info. in
              user's session object.
              I hope this helps.
              Best Regards,
              Narayan Anand
              Developer Relations Engineer
              BEA Systems, Inc.
              "Roger Lee" <[email protected]> wrote in message
              news:[email protected]...
              >
              > If I put the jsp:forward statement in all my JSPs before I test for my
              request;
              >
              > <%
              > if ( request.getParameter("SubmitStep2") != null ) {
              > String sParameter2 = request.getParameter("SubmitStep2");
              > if (sParameter2.equals("Next Step")) {
              > // CODE ETC
              > }
              > }
              >
              > The jsp will chain right to the last JSP and all the values set in my
              ValueObject
              > will remain set.
              >
              > Why does hitting a submitt button;
              >
              > <input type="submit" name="SubmitStep2" value="Next Step">
              >
              > cause the VO to lose previous stored values.
              >
              > Any information would be appreciated.
              >
              > Roger Lee
              >
              >
              > "Roger Lee" <[email protected]> wrote:
              > >
              > >Narayan,
              > >
              > >I got your example working fine.
              > >
              > >I added a few more debug statements and it appears that as I enter JSP
              > >2 the value
              > >"set" in JSP 1 is stored okay (boolean true).
              > >
              > >However after the "submit" of the button in JSP which forwards us to
              > >JSP 3 is
              > >pressed all the values are reset to their default value (false).
              > >
              > >
              > >"Narayan Anand" <[email protected]> wrote:
              > >>Hi Roger,
              > >>
              > >>I will look into your code.
              > >>In the meantime, pls try my test case in your system and see if you
              > >can
              > >>run
              > >>that without any problem.
              > >>
              > >>Best Regards,
              > >>Narayan Anand
              > >>Developer Relations Engineer
              > >>BEA Systems, Inc.
              > >>
              > >>"Roger Lee" <[email protected]> wrote in message
              > >>news:[email protected]...
              > >>>
              > >>> Narayan,
              > >>>
              > >>> Thanks for your reply. My code seems to be the same as yours! I still
              > >>can't get
              > >>> the JSPs to "set" the VO and pass it down the chain of JSPs. When
              > >I
              > >>get
              > >>the last
              > >>> JSP the first three have the boolean value set to false, whilst the
              > >>last
              > >>one is
              > >>> set to the value chosen (true).
              > >>>
              > >>> I have attached the JSPs and VO in the attached ZIP file. It must
              > >be
              > >>something
              > >>> obvious, which I can't see!
              > >>>
              > >>> Regards,
              > >>>
              > >>> Roger Lee
              > >>>
              > >>>
              > >>> "Narayan Anand" <[email protected]> wrote:
              > >>> >
              > >>> >
              > >>> >
              > >>> >------=_NextPart_001_02EB_01C257F2.2EC54EA0
              > >>> >
              > >>> >Hi Roger,
              > >>> >
              > >>> >I can still view my previous reply to your post.
              > >>>
              >
              >>>http://216.148.48.100/cgi-bin/dnewsweb?cmd=3Darticle&group=3Dweblogic.dev
              =
              > >>> >eloper.interest.jsp&item=3D10138&utag=3D
              > >>> >
              > >>> >Just now I tested this again.
              > >>> >WLS6.1SP2 on Win2k.
              > >>> >
              > >>> >JSP1 - sets one value using setProperty tag.
              > >>> >JSP2 - sets second property using the VO's setter.
              > >>> >JSP3 - retrieve and prints the values using the VO's getters and
              > >also
              > >>> >=
              > >>> >using the getProperty tag.
              > >>> >
              > >>> >attached are all the jsp's and value object.
              > >>> >Please test it in your environment. It should work.
              > >>> >Then compare it with your code to see the difference.
              > >>> >
              > >>> >I hope this will help to resolve the issue.
              > >>> >
              > >>> >Regards,
              > >>> >Narayan Anand
              > >>> >Developer Relations Engineer
              > >>> >BEA WebLogic Support
              > >>> >
              > >>> >
              > >>> >
              > >>> >
              > >>> >
              > >>> > "Roger Lee" <[email protected]> wrote in message =
              > >>> >news:[email protected]...
              > >>> >
              > >>> > Someone posted a response from BEA which has since disappeared,
              > >>it
              > >>> >was =
              > >>> >no different
              > >>> > from what I was doing and it I still can't get it to store the
              > >=
              > >>> >information in
              > >>> > the Value Object.
              > >>> >
              > >>> > I get values (true/false) from a Radio button on a FORM in a JSP,
              > >>=
              > >>> >press a "Next
              > >>> > Step" Button.
              > >>> >
              > >>> > I have a "Value Object" in JSP_1, which I use the setters to store
              > >>> >=
              > >>> >various information
              > >>> > obtained from the <FORM>. I then "jsp:forward" to JSP_2, set
              different
              > >>> >=
              > >>> >information
              > >>> > and then I "jsp:forward" to JSP_3 & so on. At the end of the JSP
              > >>chain
              > >>> >=
              > >>> >only the
              > >>> > last setter is has the value "true", all the other values are
              false,
              > >>> >=
              > >>> >despite all
              > >>> > being "set" to "true".
              > >>> >
              > >>> > The "Value Object" is not storing the information set in previous
              > >>=
              > >>> >JSPs. When I
              > >>> > initially create the "value object" I use;=20
              > >>> >
              > >>> > <jsp:useBean id=3D"myVO" class=3D"uk.co.notify.valueobjects.MyVO"
              > >>=
              > >>> >scope=3D"request"
              > >>> > />=20
              > >>> > <jsp:setProperty name=3D"myVO" property=3D"*"/>=20
              > >>> >
              > >>> > In JSP_2 JSP999 I don't use <jsp:setProperty> I let the setter
              > >>in
              > >>> >=
              > >>> >the VO do
              > >>> > it.
              > >>> >
              > >>> > I am using WebLogic 6.1 sp2 under Windows 2K Pro.=20
              > >>> >
              > >>> > Any pointers. Thanks.=20
              > >>> >
              > >>> >
              > >>> >------=_NextPart_001_02EB_01C257F2.2EC54EA0
              > >>> >
              > >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
              > >>> ><HTML><HEAD>
              > >>> ><META http-equiv=3DContent-Type content=3D"text/html; =
              > >>> >charset=3Diso-8859-1">
              > >>> ><META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
              > >>> ><STYLE></STYLE>
              > >>> ></HEAD>
              > >>> ><BODY bgColor=3D#ffffff>
              > >>> ><DIV><FONT face=3DArial size=3D2>Hi Roger,</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>I can still view my previous reply
              > >>to
              > >>> >=
              > >>> >your=20
              > >>> >post.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2><A=20
              > >>>
              >href=3D"http://216.148.48.100/cgi-bin/dnewsweb?cmd=3Darticle&group=3D=
              > >>> >weblogic.developer.interest.jsp&item=3D10138&utag">http://216.148=
              > >>>
              >..48.100/cgi-bin/dnewsweb?cmd=3Darticle&group=3Dweblogic.developer.int=
              > >>> >erest.jsp&item=3D10138&utag</A>=3D</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>Just now I tested this =
              > >>> >again.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>WLS6.1SP2 on Win2k.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>JSP1 - sets one value using
              setProperty
              > >>> >=
              > >>> >
              > >>> >tag.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>JSP2 - sets second property using
              > >>the
              > >>> >=
              > >>> >VO's=20
              > >>> >setter.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>JSP3 - retrieve and prints the
              values
              > >>> >=
              > >>> >using the=20
              > >>> >VO's getters and also using the getProperty tag.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>attached are all the jsp's and
              value=20
              > >>> >object.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>Please test it in your environment.
              > >>> >It =
              > >>> >should=20
              > >>> >work.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>Then compare it with your code to
              > >>see
              > >>> >=
              > >>> >the=20
              > >>> >difference.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>I hope this will help to resolve
              > >>the=20
              > >>> >issue.</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2>Regards,<BR>Narayan
              Anand<BR>Developer
              > >>> >=
              > >>> >Relations=20
              > >>> >Engineer<BR>BEA WebLogic Support</FONT></DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><DIV><FONT face=3DArial size=3D2></FONT> </DIV>
              > >>> ><BLOCKQUOTE=20
              > >>> >style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px;
              > >>=
              > >>> >BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
              > >>> > <DIV>"Roger Lee" <<A=20
              > >>> > href=3D"mailto:[email protected]">[email protected]</A>> wrote
              > >in
              > >>> >=
              > >>> >message <A=20
              > >>> > =
              > >>>
              >
              >>>href=3D"news:[email protected]">news:[email protected]
              =
              > >>> >a.com</A>...</DIV><BR>Someone=20
              > >>> > posted a response from BEA which has since disappeared, it was
              > >no=20
              > >>> > different<BR>from what I was doing and it I still can't get it
              > >to
              > >>=
              > >>> >store the=20
              > >>> > information in<BR>the Value Object.<BR><BR>I get values
              (true/false)
              > >>> >=
              > >>> >from a=20
              > >>> > Radio button on a FORM in a JSP, press a "Next<BR>Step" =
              > >>> >Button.<BR><BR>I have=20
              > >>> > a "Value Object" in JSP_1, which I use the setters to store
              various=20
              > >>> > information<BR>obtained from the <FORM>. I then "jsp:forward"
              > >>> >to =
              > >>> >JSP_2,=20
              > >>> > set different information<BR>and then I "jsp:forward" to JSP_3
              > >&
              > >>> >=
              > >>> >so on. At=20
              > >>> > the end of the JSP chain only the<BR>last setter is has the value
              > >>=
              > >>> >"true", all=20
              > >>> > the other values are false, despite all<BR>being "set" to =
              > >>> >"true".<BR><BR>The=20
              > >>> > "Value Object" is not storing the information set in previous JSPs.
              > >>> >=
              > >>> >When=20
              > >>> > I<BR>initially create the "value object" I use; =
              > >>> ><BR><BR><jsp:useBean=20
              > >>> > id=3D"myVO" class=3D"uk.co.notify.valueobjects.MyVO" =
              > >>> >scope=3D"request"<BR>/>=20
              > >>> > <BR><jsp:setProperty name=3D"myVO" property=3D"*"/> <BR><BR>In
              > >>> >=
              > >>> >JSP_2=20
              > >>> > JSP999 I don't use <jsp:setProperty> I let the setter in the
              > >>> >=
              > >>> >VO=20
              > >>> > do<BR>it.<BR><BR>I am using WebLogic 6.1 sp2 under Windows 2K Pro.
              > >>> >=
              > >>> ><BR><BR>Any=20
              > >>> > pointers. Thanks. <BR></BLOCKQUOTE></BODY></HTML>
              > >>> >
              > >>> >------=_NextPart_001_02EB_01C257F2.2EC54EA0--
              > >>> >
              > >>> >
              > >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
              > >>> ><HTML>
              > >>> ><HEAD>
              > >>> ><TITLE>Reusing JavaBeans in JSP</TITLE>
              > >>> ><LINK REL=STYLESHEET
              > >>> > HREF="My-Style-Sheet.css"
              > >>> > TYPE="text/css">
              > >>> ></HEAD>
              > >>> >
              > >>> ><BODY>
              > >>> >
              > >>> ><CENTER>
              > >>> ><TABLE BORDER=5>
              > >>> > <TR><TH CLASS="TITLE">
              > >>> > Reusing JavaBeans in JSP</TABLE>
              > >>> ></CENTER>
              > >>> ><P>
              > >>> >
              > >>> ><jsp:useBean id="test" scope="request" class="hall.SimpleBean" />
              > >>> ><jsp:setProperty name="test"
              > >>> > property="message"
              > >>> > value="Hello forward WWW" />
              > >>> >
              > >>> ><jsp:forward page="/myjsp2.jsp" />
              > >>> >
              > >>> ></BODY>
              > >>> ></HTML>
              > >>> >
              > >>> >
              > >>> >
              > >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
              > >>> ><HTML>
              > >>> ><HEAD>
              > >>> ><TITLE>Reusing JavaBeans in JSP</TITLE>
              > >>> ><LINK REL=STYLESHEET
              > >>> > HREF="My-Style-Sheet.css"
              > >>> > TYPE="text/css">
              > >>> ></HEAD>
              > >>> >
              > >>> ><BODY>
              > >>> >
              > >>> ><CENTER>
              > >>> ><TABLE BORDER=5>
              > >>> > <TR><TH CLASS="TITLE">
              > >>> > Reusing JavaBeans in 2 JSP</TABLE>
              > >>> ></CENTER>
              > >>> ><P>
              > >>> >
              > >>> ><jsp:useBean id="test" scope="request" class="hall.SimpleBean" />
              > >>> >
              > >>> > <% test.setMessage1("Second message1 using setters"); %>
              > >>> >
              > >>> >
              > >>> ><jsp:forward page="/myjsp3.jsp" />
              > >>> >
              > >>> >
              > >>> ></BODY>
              > >>> ></HTML>
              > >>> >
              > >>> >
              > >>> >
              > >>> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
              > >>> ><HTML>
              > >>> ><HEAD>
              > >>> ><TITLE>Reusing JavaBeans in JSP</TITLE>
              > >>> ><LINK REL=STYLESHEET
              > >>> > HREF="My-Style-Sheet.css"
              > >>> > TYPE="text/css">
              > >>> ></HEAD>
              > >>> >
              > >>> ><BODY>
              > >>> >
              > >>> ><CENTER>
              > >>> ><TABLE BORDER=5>
              > >>> > <TR><TH CLASS="TITLE">
              > >>> > Reusing JavaBeans in 2 JSP</TABLE>
              > >>> ></CENTER>
              > >>> ><P>
              > >>> >
              > >>> ><jsp:useBean id="test" scope="request" class="hall.SimpleBean" />
              > >>> >
              > >>> ><%
              > >>> >System.out.println("\nMessage is :"+test.getMessage());
              > >>> >System.out.println("\nMessage1 is :"+test.getMessage1());
              > >>> >%>
              > >>> >
              > >>> ><H1>Message: <I>
              > >>> ><jsp:getProperty name="test" property="message" />
              > >>> ></I></H1>
              > >>> >
              > >>> ><H1>Message1: <I>
              > >>> ><jsp:getProperty name="test" property="message1" />
              > >>> ></I></H1>
              > >>> >
              > >>> >
              > >>> ></BODY>
              > >>> ></HTML>
              > >>> >
              > >>> >
              > >>> >
              > >>> >package hall;
              > >>> >
              > >>> >public class SimpleBean {
              > >>> > private String message = "No message specified";
              > >>> > private String message1 = "No message1 specified";
              > >>> >
              > >>> > public String getMessage() {
              > >>> > return(message);
              > >>> > }
              > >>> >
              > >>> > public void setMessage(String message) {
              > >>> > this.message = message;
              > >>> > }
              > >>> >
              > >>> > public String getMessage1() {
              > >>> > return(message1);
              > >>> > }
              > >>> >
              > >>> > public void setMessage1(String message1) {
              > >>> > this.message1 = message1;
              > >>> > }
              > >>> >}
              > >>> >
              > >>> >
              > >>>
              > >>
              > >>
              > >
              >
              

  • Modification to Pending Value Object

    Hi,
    we have defined an Add Member Task for all Privileges, so that a Pending Value Object (PVO) is created and an approval step can be performed.
    Within the approval step we would like the user to add additional information (a reference to an MX_PERSON object). However, when the user adds such an attribute value in the approval window, the attribute value is not written to the database.
    Is it possible that a PVO cannot be modified within an approval step? Is there any workaround to this behaviour?
    Thanks in advance for your help.
    Best regards
    Holger

    Hi Dominik,
    thanks for the hint - I was already considering to use a custom PVO, but so far I haven't found an easy way to implement this when only requesting new privileges or roles.
    I can see two alternatives in using a custom PVO:
    1. We still have the Add Member Task defined on the privilege. When a privilege is requested, I get a standard PVO. I would then have to start/create my custom PVO and perform the approval. The problem with that solution is that I need to make sure that the standard PVO Ordered Task Group is waiting for the  completion of my custom PVO. So we would need to perform a tricky synchronization between the tasks.
    2. We do not have an Add Member Task. In this case we need to make sure that the provisioning is not immediately started once the user has pressed the Submit button. So I would need to make sure that we do not use the MX_PRIVILEGE attribute on the interface, but rather another temporary attribute that shows all the available privileges. In that case I would lose some of the functionality when searching for privileges and showing the user's current privileges is not that easy.
    Did you also implement requesting additional privileges with custom PVOs?
    Best regards
    Holger

  • Inserting a tree of value objects

    Let's say I have these entities in my database:
    Person
    personId (PK)
    firstName
    lastName
    PhoneNumber
    phoneNumberId (PK)
    number
    description
    personId (FK referencing Person entity)
    I have a PersonValueObject class with the following attributes:
    Integer personId
    String firstName
    String lastName
    Collection phoneNumbers (a collection of PhoneNumberValueObject's - can be populated or set to null, depending on use case)
    I have a PhoneNumberValueObject class with the following attributes:
    Integer phoneNumberId
    String number
    Strong description
    Integer personId
    PersonValueObject person (can be populated or set to null, depending on the use case)
    I have session facade with the following methods
    createPerson(PersonValueObject personVO)
    createPhoneNumber(PhoneNumberValueObject phoneNumberVO)
    My question is, how should I insert a tree containing a Person and his related PhoneNumbers? I see three options:
    1) The session facade's client calls createPerson(), which inserts the personVO and then the session facade traverses the personVO.phoneNumbers collection and calls createPhoneNumber() internally for every element in the collection. This means that the createPerson() method must have extra code to traverse the collection.
    2) The session facade's client calls createPerson(), which inserts the personVO. Next, the session facade's client traverses the personVO.phoneNumbers collection and calls createPhoneNumber() for every element in the collection. This means that the client must have extra code to traverse the collection.
    3) Add a third method called createPersonTree(PersonValueObject personVO), which internally calls createPerson() and then internally calls createPhoneNumber(). In this case, the createPersonTree() method must have the extra code to traverse the collection. The way I see it, the advantage of this approach is that the session facade's client has a choice of calling createPersonTree(), if it needs to insert a whole tree, whereas it can just call createPhoneNumber() directly if it just needs to add a new phone number to an existing person.
    Comments?

    1) Are you using session Bean for inserting the data?
    2) Are you using the Entity Beans, I mean BMP?
    3) Have you looked in the features provided by the
    CMP2.0.Let me explain all the patterns I am using. The client is a regular java class that implements the "business delegate" pattern. The business delegate communicates with a session bean that is implementing the "session facade" pattern. It is this session facade that has those methods I referred to above, namely createPerson(), createPhoneNumber() and potentially createPersonTree(). The session facade communicates with a Person entity bean and a PhoneNumber entity bean, which implement the persistence layer. Both of these entity beans use EJB 2.0 CMR and CMP. The actual inserts are performed by these entity beans. For example, inside the session facade's createPerson() method, the session facade delegates the actual insert to the Person entity bean.
    Data is passed between objects by using the "value object" pattern. For example, the business delegate passes person data to the session facade inside a Person value object. The session facade also passes this value object to the entity bean (alternatively, the session facade could pass the person's attributes individually, but I thought this was not as convenient).
    I hope that explains the situation.

  • Value Object pattern implementation problem

    Hi All!
    I try to implement value object pattern in my bean as follows:
    /* Simplified code */
    public class Value implements Serializable {
    private String s;
    public setS(String value){
    s = value
    public getS(){return s}
    bean class:
    public class Bean extends Value implemets EntityBean {
    public Value getValue(){return this}
    Now question.
    When I try run this code I get next message
    org.omg.CORBA.MARSHAL: minor code: 0 completed: No
    org.omg.CORBA.portable.InputStream com.visigenic.vbroker.orb.GiopStubDelegate.invoke(org.omg.CORBA.Object, org.omg.CORBA.portable.OutputStream, org.omg.CORBA.StringHolder, org.omg.CORBA.Context, org.omg.CORBA.ContextList)
    org.omg.CORBA.portable.InputStream com.visigenic.vbroker.orb.GiopStubDelegate.invoke(org.omg.CORBA.Object, org.omg.CORBA.portable.OutputStream, org.omg.CORBA.StringHolder)
    org.omg.CORBA.portable.InputStream com.inprise.vbroker.CORBA.portable.ObjectImpl._invoke(org.omg.CORBA.portable.OutputStream, org.omg.CORBA.StringHolder)
    com.retailpro.cms.common.InventoryValue com.retailpro.cms.ejb._st_Inventory.getValue()
    void com.retailpro.cms.inventory.SetInventory._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
    void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
    void oracle.jsp.app.JspApplication.dispatchRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
    void oracle.jsp.JspServlet.doDispatch(oracle.jsp.app.JspRequestContext)
    void oracle.jsp.JspServlet.internalService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
    void oracle.jsp.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
    void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
    void oracle.lite.web.JupServlet.service(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
    void oracle.lite.web.MimeServletHandler.handle(oracle.lite.web.JupApplication, java.lang.String, int, oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
    void oracle.lite.web.JupApplication.service(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
    void oracle.lite.web.JupHandler.handle(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
    void oracle.lite.web.HTTPServer.process(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
    boolean oracle.lite.web.HTTPServer.handleRequest(oracle.lite.web.JupInputStream, oracle.lite.web.JupOutputStream)
    boolean oracle.lite.web.JupServer.handle(oracle.lite.web.JupInputStream, oracle.lite.web.JupOutputStream)
    void oracle.lite.web.SocketListener.process(java.net.Socket)
    void oracle.lite.web.SocketListener$ReqHandler.run()
    Seems like object can't be serialized.
    But when I change my getValue() to next
    public Value getValue(){
    Value result = new Value();
    result.setS(s);
    return result;
    Everything goes fine!
    Can anybody comments this situation?
    Any information will be appreciated!
    Mike
    null

    Have you tried using our Business Components for Java framework to assist in developing your EJB components. BC4J is a design pattern framework that implements the J2EE Blueprints design patterns out of the box:
    [list][*]Session-Entity Fagade
    [*]Paged-List
    [*]Unified Data Access & Logic
    [*]Value Object
    [*]Model View Controller
    [list]
    and more...
    So many things you don't have to code yourself when you use BC4J to turbocharge your development... Also, using BC4J insulates you from having to choose once and for all at the beginning of your project that you ARE USING EJB AT ALL COSTS on your project.
    Many projects discover that they don't require a distributed objects configuration, but end up paying for it in architectural complexity and EJB's assumption that all beans might be located on remote VM's.
    With BC4J, you can build an app, deploy to EJB if you need EJB for a given project, or deploy to CORBA, or just to simple Java classes for improved performance without the remoting overheads. All without touching your application code.
    Pretty cool, I think. But of course, I'm biased :-)
    Steve Muench
    Lead Product Manager for BC4J and Lead XML Evangelist, Oracle Corp
    Author, Building Oracle XML Applications

  • Xdoclet session facade + value object

    Hi Community,
    I have created an value object and a session facade with:
    @ejb.facade view type="local"
    @ejb.value-object match="*" name="CategoryEJB"
    The new facade class is missing getData() inCategoryEJBLocal.
    I have extendet the CMP for the ValueObject
    * @ejb.interface-method view-type = "both"
    * @return
    public abstract CategoryEJBValue getCategoryValue();
    * @ejb.interface-method view-type = "both"
    * @param categoryValue
    public abstract void setCategoryValue(CategoryEJBValue categoryValue);
    What I have to do to solve the error?
    Many thanks in advance
    Oliver

    Problem solved.

  • Stale Value Objects

    We are using Session Beans, Data Access Objects, and Value Objects in our application (no EBs). A majority of our database tables do not have timestamp columns and we are wondering how others handle stale value objects when timestamps aren't available. Is adding the timestamp column the best way to fix this? Has anyone implemented a different solution?
    Thanks,

    I assume that if use processing flags for the state of these objects u will be still have problem of data integrity,If you use session beans its good to use a time stamp column in the database and that time stamp can be used as a check value,.. if u had used BMP that u could u have used processing flags in BMP
    There is a good pattern defined on this issue on www.theserverside.com have a look at it
    thanks
    Jay

  • BusinessDelegate and Value Object Patterns

    I have just embarked on the facinating world of J2EE. My questions are very simple:
    Why would I use a BusinessDelegate pattern? What is it and why have this extra tier?
    Finally, why would I use a Value Object? What are they? How would I use them in practice?
    As you can see I am a total novice and would appreciate expert advice. Thanks in advance.

    Why would I use a BusinessDelegate pattern? What is it
    and why have this extra tier?Well, there are always some extra "plumbing" work involved when calling business services, especially if they are located in remotely hosted EJBs. You need to create your JNDI-context, perform a lookup, do narrow()-operations etc. etc.
    Now this is implementation-specific stuff, that your presentation tier doesn't really need. No, it's only concerned about sending some values to the business-logic tier, and retrieving the results and acting upon them (usually formatting and displaying them to the end-user at some way).
    If you wouldn't have BusinessDelegate as an extra insulation layer between your presentation and business tiers, you'd end up cluttering your presentation code with unnecesessary implementation-specific stuff. When you have a BusinessDelegate, you can isolate all the dirty work into it, make it configurable somehow, and just call it from your Servlets/JSPs/Applets whatever.
    So instead of this:
    InitialContext ctx = new InitialContext();
    Object home = ctx.lookup( "com.company.myproject.ejb.FirstBusinessBean" );
    FirstBusinessBeanHome narrowedHome = (FirstBusinessBeanHome)PortableRemoteObject.narrow( home, FirstBusinessBeanHome.class );
    FirstBusinessBean remote = home.create();
    // Only now you get down to the real business.
    String[] initialValues = remote.readInitialValues();
    // And so on.
    // Some stuff like try..catch suppressed for readability.You can do something simple as this:
    EJBDelegate myDelegate = EJBDelegate.getInstance( MyBeans.FIRST_BUSINESS_BEAN );
    String[] initialValues = myDelegate.readInitialValues();
    Finally, why would I use a Value Object? What are
    they? How would I use them in practice?A value object is an object whose sole purpose is to represent a value (or a bunch of values). In the previous example, if you needed to get a list of persons from you database, and one person is represented as one entity bean, at first you'd probably end up getting a collection of PersonEntityBean's remote interfaces as a result of some ejbFindBy()-query method.
    Now if you are running on a true distributed enviroment, when you iterate through this collection, displaying the persons ie. on a JSP page, every getFirstName(), getLastName(), getTitle() etc. call could potentially be a remote method call, adding a tremendous amount of extra overhead. This of course depends entirely upon your app servers implementation.
    But if you replace your Remote interfaces with a simple Value object, for example PersonVO, it could be as simple as this:
    public class PersonVO
        String firstName, lastName, title;
        public PersonVO( String firstName, String lastName, String title )
            this.firstName = firstName;
            this.lastName = lastName;
            this.title = title;
       public void getFirstName() { return this.firstName; }
       public void getLastName() { return this.lastName; }
       public void getTitle() { return this.title; }
    }Instead of a collection of remote interfaces, you return these from your business method, and use them for displaying in your presentation logic. Simple, clean and fast.
    Oh, and notice that the VO is immutable. This is a done on purpose.
    Another point where a VO is really helpful that if you have ie. two different tables in your DB, represented by two different Entity Beans (Person and PhoneNumber for example), which have a relation at the database. With a VO, you can package data from multiple entities into a single object, instead of having to deal with a multitude of different entities and their remote interfaces.
    I could go on for hours about this, but I guess I'll have to do some productive work as well. Anyway, these patterns are tried and tested, any believe me, they make the job a lot easier when properly implemented.
    .P.

  • Design patterns,about value object ,how?why?could you give me a soluttion

    design patterns,about value object ,how?why?could you give me a soluttion
    use value object in ejb,thanks
    i want not set/get the value in ejb,find the method to solve it ,use value
    object ?
    how? thanks.

    Hai
    Enter your telephone number here, at the top it will say your Exchange, Phone and cabient number. If it doesn't mention cabinet that means you are directly connected to the exchange and not via PCP.
    If you are connected to a cabinet and it doesn't say FTTC is available, ask your neighbor to-do the same test (they have 2 be infinity connected). If they are, then proceed to contact the moderators here. Though it could not be showing because all the ports have been used up in the FTTC Cabinet.
    If this helped you please click the Star beside my name.
    If this answered your question please click "Mark as Accepted Solution" below.

  • What is Value object?

    Hi there,
    What is Value object in EJB?
    TQ
    Neo

    The main idea of a value object is to group information into chunks to minimize the chattiness of a distributed system.
    For example if you had a EJB that represented a user you might have methods called getFirstName, getLastName, getPhone, etc. Each time you call one of those methods from a remote context, you have to make a separate remote call. Each remote call involves a bunch or IP and ethernat headers that you never see but must be transfered across the network. So if you are getting two bytes of data you are really sending several hundreds or thousands of bytes of data. It's inefficient. If you were using value objects you would create a call called UserValueObject that would contain all the info about that user. Then you would have a method called getUser on your bean that would fill up the value object and return it. Then you have all the data you need about the user without making umpteen remote calls. The same thing goes for updates.

  • Backup 3 v3.2, is it still relevant?

    Hi
    I have the Backup 3 application on my iMac, running Mountain Lion.
    I am also using time machine.
    I was in the Apple Store today (not with my iMac).  I couldn't find the application on any of their machines.  Their techncians were not familiar with the program.
    Is Backup still relevant to use?

    Hi
    I would delete the oldest back ups first, but it depends on the size of the drive and the size of your hard disk.
    look for full backups in there too delete the oldest if there is more than 1, however I would probably just format the drive, wiping it clean and do a fullbackup leaving the machine on overnight with sleep turned off in system preferences if it were me. Then in the morning everything you need is there!
    If you want to hold onto some older files you no longer have but that has been backed up in the past, youll need to use time machine to locate those files, restore them and then do a full backup.
    Kind Regards
    Andrew

  • Dynamically create Value Objects from XML file

    Hi
    I want to create a value object from Xml file dynamically,like in the xml file i have the name of the variable and the datatype of the variable.is it possible do that,if so how.

    Read about apache's Digester tool. This is part of the Jakartha project. This tool helps in creating java objects from the XML files. I am not sure, if that is what u r looking for.

  • Best Practice Question - Business Logic in Value Objects?

    Just wondering what people's thoughts on best practices for setting properties of Value Objects.
    For instance, I have several getter/setters in one of my Value Objects with logic in the setter that uses the value to set values of other properties.
    For example, I have a Value Object that has the following properties:
    category (of type Category, which is another Value Object with properties "name" and "id")
    categoryId (of type int)
    categoryUpdated (of type Boolean)
    I have a collection of Category Objects in the Model. When I set the categoryId of this class, I set the "categoryUpdated" to true, and dispatch an CairngormEvent to that find the "category" with the specified "categoryId" and set the "category" property to this item.
    So what is the best practice? To simply make the "categoryId" a public variable, and create a new Event/Command to perform all this logic? Or is it ok to do it all in the Value Object setter?
    Thanks.

    Hi Eric,
    I can't speak for best practices, but the only logic I've ever added to a VO were getters: an example was a set of getters on an airline flight VO to get overall flight departure/arrival times/cities from an array of flight segments in a property of the VO.
    I feel uneasy (in the nicest possible way) about your VO for two reasons: firstly it has a strong dependency on bits of the Cairngorm framework to look up the category (and VOs normally don't need to depend on anything), and secondly the intent of Commands in Cairngorm is more to represent user gestures than to wire up VO properties (I often see people shoehorning stuff into Commands that might be better of as plain old business utility classes). I would rather see an UpdateCategoryCommand (that's what the user is trying to do?) that updates categoryId and hits a delegate to populate the category property.
    That said you might have a very good reason for doing this. Could you tell us where the code is that's setting categoryId, and if anything is using categoryUpdated?
    Cheers,
    Robin

  • Need help regarding Value Object Concept in flex/java

    I need to map the java objects to flex use value objects in flex.
    The problem is I have a class in java which is referring to another class and again that class referring another class.
    For instance
    Class A
         protected User user;
    Class User
         protected Address address;
    Now I need to map class A to the flex using value object concept and I have to display the user info in the grid as well.
    Need some help to get started.

    You need to set the "scope" property in your remoting destination definition to "session" or "application".

Maybe you are looking for

  • Adobe dng and Photoshop Elements Workflow Question

    My camera isn't supported by the Camera Raw  for the PSE version that I have so I must convert the original raws into dngs using the DNG Converter.  Since the converterr doesn't operate on a file but only on a folder basis, I find that a workflow inv

  • Porting Keynote for ultra-portable shows on the road

    I am starting this thread to discuss questions of how to leverage Keynote and iCloud to deliver presentations while on-the-road with limited access to hardware. To wit: As you can see from the listings below, I have access to useful hardware and soft

  • ADF FACES: af:table not rendering all columns

    I'm using ADF EA 17 with myFaces 1.0.9 on JBoss 4.0.1/JVM 1.4.2_07-b05. The af:table is embedded within an af:panelgroup (being body of af:panelbox). The af:table is not rendering all columns (only last 2 out of 8 cols total). The model behind the af

  • B570 Laptop - No display, POST or LED

    Hi, I have a 1 year old B570 laptop which will not boot. It will not show a display, power on, POST boot and the LEDs do not light up. The problem has been on-going for a while and the laptop would occassionally refuse to boot. You would have to remo

  • Multiple Layout in report

    Hi I am creating a report with multiple layout ( to be executed as concurrent request from Apps) with following 3 layouts. 1.Group Above 2.Group Above with Matrix 3.Group Above Reports are based on Global Temporary tables which are populated in Befor