Pass Value/Transfer Object to ejbCreate?

I'm currently doing some entity bean programming and I'm thinking if it's possible to pass a Value Object to the ejbCreate method rather than a long list of parameters for all fields in an EJB.
You see most EJB tutorials that I've come across write ejbCreate as a method that takes in parameters for all fields/properties.
So we call it using say:
customerHome.create(customerId, customerName, ...blah, blah, blah,...); Since we have a Value Object, why don't we just have something like this:
CustomerVO c = new CustomerVO(customerId, customerName, ...blah...);
customerHome.create(c);Doesn't this look better and cleaner?
Anyway, how does the EJB methods mapping works? Why do I call the method .create(...) in Home interface and in the Bean implementation I've .ejbCreate(...) method instead?
What about the rest, say ejbLoad(), ejbStore, ejbRemove()? Just strip all the "ejb" infront and call them .store(), .load(), .remove() in Home interface?
Also, why do only .create(..) appear in Home interface itself? Are the rest (.store(), .load(), .remove())inherited and therefore not have to be specified?

Sorry for the formatting mistake above. Below is the corrected version.
I'm currently doing some entity bean programming and I'm thinking if it's possible to pass a Value Object to the ejbCreate method rather than a long list of parameters for all fields in an EJB.
You see most EJB tutorials that I've come across write ejbCreate as a method that takes in parameters for all fields/properties.
So we call it using say:
customerHome.create(customerId, customerName, ...blah, blah, blah,...); Since we have a Value Object, why don't we just have something like this:
CustomerVO c = new CustomerVO(customerId, customerName, ...blah...);
customerHome.create(c);Doesn't this look better and cleaner?
Anyway, how does the EJB methods mapping works? Why do I call the method .create(...) in Home interface and in the Bean implementation I've .ejbCreate(...) method instead?
What about the rest, say ejbLoad(), ejbStore, ejbRemove()? Just strip all the "ejb" infront and call them .store(), .load(), .remove() in Home interface?
Also, why do only .create(..) appear in Home interface itself? Are the rest (.store(), .load(), .remove())inherited and therefore not have to be specified?

Similar Messages

  • Passing Values to Object Type Attributes

    Hi Experts,
    I need to pass values to object type attributes amount,channel and company code from zprogram.
    I have got FM 'SWO_INVOKE'.But in this FM how will I pass values to 3 attributes.
    I have created object type through SWO1 .Is it necessary to call FM SWO_CREATE before FM 'SWO_INVOKE'.
    Please suggest.
    Regards,
    Kaustubh.

    Hi,
    I guess you will have to Initialize business object first by using the function module "SWO_CREATE' and then call the other function module to pass the attributes. I am not sure, but please check by passing the attribute name and value to the tables parameter 'CONTAINER'.
    CONTAINER-ELEMENT = <Attribute name>.
    CONTAINER-VALUE = <value from the Zprogram>.
    Hope this will help.
    Thanks,
    Samson

  • Creating generic Value/Transfer-Object

    i have written an application which gets a gui created via xml. so it depends on configuration which gui elements appear. the inputted data of the elements (index of selected radiobutton, data of textfield etc) shall now be stored in a database and therfore transfered within a value object. but im seraching for a good clean way to create this VO generically.
    e.g. the gui consists of a textfield and a checkbox the valueobject needs the information to carry a String and a Boolean object.
    any suggestions are welcome.

    very helpful. i hope its clear to see that a collection with mixed classes is not a too good idea, especially if i need to know their type for saving them to a persistance layer ..
    my goal is to avoid a "brute force" on their class-types via instanceof or reflection

  • 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;
              > >>> > }
              > >>> >}
              > >>> >
              > >>> >
              > >>>
              > >>
              > >>
              > >
              >
              

  • Default values of columns not transferred in SSIS Transfer Objects Task

    I am working on a project that is creating a new application, my area of the project being the migration of data from the old application database, transforming it, and populating the new database.
    The transformations to the old data are done in a staging database.
    At the end of the process, the staging database ends up with a lot of new applications tables, populated with the migrated legacy data.
    We need to move these tables from the staging database to (initially) our test databases, but ultimately what will be the live database.
    We have tried using the "Transfer SQL Server Objects Task" in SSIS, but have ran into a problem that a lot of the database tables have default values for columns.
    These default values are not brought over.
    Example. Tables contain a "GUID" field, which has a default of value of newid()
    Right clicking and the table generating the CREATE script generates 
    [GUID] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF_tbCRM_Client_GUID] DEFAULT (newid()),
    However, the Transfer objects task does not create this default of newid()
    Examining the SQL generated by the Import / Export Wizard when investigating this shows that the wizard generates this column as
    [GUID] uniqueidentifier NOT NULL
    and the column default value is lost.
    Is there something i should be setting somewhere to force SSIS to bring these column definitions over correctly?

     Kaarthik Sivashanmugam wrote:
    This behavior is by design to maintain backward compatibility with the Copy SQL Server Objects task in SQL Server 2000. Only two constraints (Primary key and foreign key constraints) are expected to be copied by Transfer Objects task.
    thank you for you response Sivashanmugam.
    How can I move these tables (of which there are over a hundred) from my staging database into the application database - and keep the table definitions correct?
    I cannot use the transfer objects task, as this will not define the tables correctly.
    I cannot use the import and export wizard, as this will also not define the tables correctly.
    This means I will manually have to code the drop, create and inserts for over a hundred tables?

  • How to pass conventional table values in object types Dynamically

    Hi All,
    Need urgent help...
    TYPE add_ty is object
    (add1     varchar2(50),
    add2     varchar2(50),
    add2     varchar2(50))
    type add_ty_obj is table of add_ty;
    create table company_dtl
    (cmpid          number(10),
    cmpname          varchar2(100),
    address          add_ty_obj);
    table company_dtl contains demo data as below:-
    cmpid cmpname address
    C101     abc     UK,
              USA,
              AUS
    c102     xyz     UK,
              CN,
              GER
    If I want to read data from table and pass data to object add_ty_obj,
    So How can I do it dynamically. I am willing to create procedure
    which can read data from above table and pass that to mentioned object in
    OUT parameter.
    Out parameter contains same object type somewhere in middleware.
    Please help or advice.
    Thanks in Advance..

    Hi
    i have tried to make procedure that take company id as input and give their address as output.I think it might be useful for you. Or if you want something different
    please write us with more detail.
    CREATE OR REPLACE PROCEDURE READ_DATA_PROC( VAR_CMPID IN NUMBER , VAR_TYP OUT ADD_TY_OBJ)
    AS
    BEGIN
    SELECT ADDRESS INTO VAR_TYP FROM COMPANY_DTL WHERE CMPID = V_CMPID ;
    END READ_DATA_PROC;
    here i'm also adding your table and type definition i've used
    CREATE TYPE ADD_TY IS OBJECT
    (ADD1 VARCHAR2(50),
    ADD2 VARCHAR2(50),
    ADD3 VARCHAR2(50));
    CREATE TYPE ADD_TY_OBJ AS TABLE OF ADD_TY;
    CREATE TABLE COMPANY_DTL
    (CMPID NUMBER(10),
    CMPNAME VARCHAR2(100),
    ADDRESS ADD_TY_OBJ)
    NESTED TABLE ADDRESS STORE AS ADDRESS_TAB;thanks,
    Neeraj
    Edited by: Neeraj.Ora on Feb 26, 2011 1:03 PM

  • Transfer Object (Value Object)

    Hi Friends
    I am want to Use TO in Swing. But i do not know how to.
    If You have any knowledge about To in Swings please provide me.
    Thanks
    ---SunnyJain

    well that is not what i wanted ..
    They have some thing link this usage in J2EE.
    http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html
    I want to make swing client Table to use a Transfer Object to send data and receive data.

  • Transfer Objects in EJB 3.0

    Hello,
    I am building Enterprise application with EJB 3.0 and JSF. In many J2EE books there's that Trasfer Object pattern ( sometimes called Value Object or so), I just wonder what are your experiences in using TO in Java EE ( EJB 3.0).
    Because entity beans in EJB 3.0 are POJOs I think that there is no need to
    use TO pattern.
    Im my app I receive entity from session bean and bind that entity to JSF components. This is the easisest solution for me because I don't build boring
    transfer object, and don't have to wory about transformation between TO and Entity beans. Am I doing right or I am maybe missing something??
    By reading EJB 3.0 spec. when session bean returns entity it becomes
    detached so its just plain java object. ??
    I know that using TO you can reduce coupling between client and EJB but
    you must implement additional level with TO objects and transformations, so
    it looks to me that by using TO you just get more complexity and problems ?
    Tell me what are your thoughts and experiences.
    Regards,
    Niksa Jakovljevic
    FOS

    Hi Niksa,
    Your intuition about EJB 3.0 is correct. One of the advantages of Java Persistence API entities
    is that they can be passed directly to clients without having to convert their data to separate transfer
    objects. The reason this was a common pattern in EJB 2.x and earlier is that CMP 2.x beans are 1st
    class EJB components that are limited in their ability to be used outside of the ejb tier.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Business Objects(BOs) & Data Transfer Objects(DTOs)-both needed ?

    In a J2EE system...
    I know that "Business Objects" (BOs) are basically value objects (VOs) ...lots of getters and setters and some business logic. These are basically to model nouns in the system. Eg Student BO.
    I know that "Data Transfer Objects" (DTOs) are value objects (VOs)....with getters and setters... with the purpose of avoiding multiple method calls...to avoid overhead...which effects performance. eg it's better to pass a Student DTO then say...pass the student ID and student name and student age etc etc.
    Main question : Should a system have both ? If yes, why do I need a StudentBO.java and then another StudentDTO.java....when they are so similar ?...when both are basically VOs ? Can't I just use BOs to serve as DTOs ?
    Thanks.

    Hi,
    I've started using BO's and DTO's since 3 months .With my experiece i understand we nned both of them.
    The BusinessObject represents the data client. It is the object that requires access to the data source to obtain and store data.
    DTO
    This represents a Transfer Object used as a data carrier. The DataAccessObject may use a Transfer Object to return data to the client. The DataAccessObject may also receive the data from the client in a Transfer Object to update the data in the data source.
    From this i want to tell you that We are not gonna do any operation on BO's but we do operations on DTO
    Ashwin

  • How to combine Session Facade and Transfer object?

    Hello All!
    I'm working on an enterprise application. Presentation layer is a stand alone client, business logic is build on the Glassfish v2.1 and MySQL is used as a database. The client is connection to the GlassFishj server remotely using EJBs.
    I have problems with business logic architecture.
    Here is the brief description of backend application architecture design:
    1. Session Facade pattern is used to simplify the client and application server interface and to provide application layers between backend (http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html).
    2.Transfer Object pattern to define update transfer objects strategy in order to decrease network overhead during client and application server interactions and to provide version control for objects. Transfer objects are designed as simple java business serializable objects. (http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html)
    3. Originally the backend application consisted of three modules: users, storage and orders, but at the end I have decided to divide my application into the following parts - assortments, map, menu, orders, transactions, users.
    4. All MySQL database transactions are via JDBC using procedures. No use of entity beans.
    Questions:
    1. I have some doubts about using Session Facade and Transfer object patterns at the same time. At first I'd mike to cite the definitions of the patters from the SUN official web site.
    * Use a session bean as a facade to encapsulate the complexity of interactions between the business objects participating in a workflow. The Session Facade manages the business objects, and provides a uniform coarse-grained service access layer to clients.
    * Use a Transfer Object to encapsulate the business data. A single method call is used to send and retrieve the Transfer Object. When the client requests the enterprise bean for the business data, the enterprise bean can construct the Transfer Object, populate it with its attribute values, and pass it by value to the client.
    * So, if I use Transfer Object along with Session Facade, it makes some difficulties with object version control, because I 2 or
    3 transfer objects controls with the 1 bean class. The best option for Transfer object Pattern is that each transfer object should have its own bean class to provide ability of object's version control. In the case it can bring the network overhead because of frequent remote calls caused by the large number of the bean classes.
    * So, should I use the both patterns? If yes, how to manage the interaction the patterns. If no, which one to use.
    2. E.g. I have a huge list of the Order objects and each Order object consists of other complicated objects. So, would I have trouble to transfer that list over network? If yes, how to manage it.
    Thank you!
    Astghik

    Astghik wrote:
    Hello All!
    I'm working on an enterprise application. Presentation layer is a stand alone client, business logic is build on the Glassfish v2.1 and MySQL is used as a database. The client is connection to the GlassFishj server remotely using EJBs.
    I have problems with business logic architecture.
    Here is the brief description of backend application architecture design:
    1. Session Facade pattern is used to simplify the client and application server interface and to provide application layers between backend (http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html).
    I would simply recommend establishing a service tier. Your services should be stateless. You can go the extra mile and have a session facade, but in the majority of cases, coding to an interface for your service accomplishes the same goals.
    2.Transfer Object pattern to define update transfer objects strategy in order to decrease network overhead during client and application server interactions and to provide version control for objects. Transfer objects are designed as simple java business serializable objects. (http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html)
    The idea of the transfer object is very similar to the Command pattern. I think if you investigate that pattern, it will be more obvious. The transfer object reduces network latency by consolidating all the parameters into an object, ideally, this also consolidates multiple method calls. If you combine a transfer object (or command object) with a service tier, you get the best of both worlds. The service can delegate calls to helper objects (or other services or components) using the data in the transfer / command object.
    3. Originally the backend application consisted of three modules: users, storage and orders, but at the end I have decided to divide my application into the following parts - assortments, map, menu, orders, transactions, users.
    The is your domain. It will vary from application to application. The principles above are more general (e.g., patterns and architectural tiers) and should apply to most domains. However, your actual use case may require something different.
    4. All MySQL database transactions are via JDBC using procedures. No use of entity beans.
    Consider using something like iBatis or Spring's JDBC templating to make your life easier with JDBC.
    Questions:
    1. I have some doubts about using Session Facade and Transfer object patterns at the same time. At first I'd mike to cite the definitions of the patters from the SUN official web site.
    * Use a session bean as a facade to encapsulate the complexity of interactions between the business objects participating in a workflow. The Session Facade manages the business objects, and provides a uniform coarse-grained service access layer to clients.
    * Use a Transfer Object to encapsulate the business data. A single method call is used to send and retrieve the Transfer Object. When the client requests the enterprise bean for the business data, the enterprise bean can construct the Transfer Object, populate it with its attribute values, and pass it by value to the client.
    * So, if I use Transfer Object along with Session Facade, it makes some difficulties with object version control, because I 2 or
    3 transfer objects controls with the 1 bean class. The best option for Transfer object Pattern is that each transfer object should have its own bean class to provide ability of object's version control. In the case it can bring the network overhead because of frequent remote calls caused by the large number of the bean classes.
    * So, should I use the both patterns? If yes, how to manage the interaction the patterns. If no, which one to use.
    Versioning is a separate issue. Generally, the more coarsely grained your transfer / command object is, the more changes are likely to impact dependent objects.
    Your command or transfer object does not have to be a vanilla JavaBean, where you are basically creating a bean that has data from other objects. You can simply use your command / transfer object to encapsulate already existing domain objects. I see no need to map to a JavaBean with what you have described.
    Generally, a method signature should be understandable. This means that many times it is better to pass the method, say, two coarsely grained objects than a signature with a dozen primitives. There are no hard and fast rules here. If you find a method signature getting large, consider a transfer / command object. If you want one service to delegate calls to a number of other services, you can also create a transfer / command object to furnish the controlling service with the data it needs to invoke the dependent services.
    2. E.g. I have a huge list of the Order objects and each Order object consists of other complicated objects. So, would I have trouble to transfer that list over network? If yes, how to manage it.
    This is a large, open-ended question. If you are going to display it to a user on a screen, I do not see how you avoid a network transfer with the data. The general answer is to not pass the data itself but rather a token (such as a primary key, or a primary key and a start and stop range such as you see on a Google search result). You do want to limit the data over the network, but this comes at a cost. Usually, the database will receive additional load. Once that becomes unacceptable, you might start putting things into session. Then you worry about memory concerns, etc. There is no silver bullet to the problem. It depends on what issues you are trying to address and what trade-offs are acceptable in your environment.
    Thank you!
    AstghikBest of luck.
    - Saish

  • Transfer object,  FindByPrimaryKey, session facade

    I would like to request help on coding a 'facade session' bean that invokes the FindByPrimaryKey method on a BMP entity bean, and how to put the returned values into a transfer object. I've been trying to modify the code provided in Sun's 'Duke's Bank Application' to accomplish this. Below is the code copied and pasted from Sun's session facade. 'accountIds' is a Collection that contains the values (customerId, balance, etc) of bank accounts which were retrieved with a FindBy method. AccountDetails produces a transfer object.
    try {
    Iterator i = accountIds.iterator();
    while (i.hasNext()) {
    Account account = (Account)i.next();
    AccountDetails accountDetails = account.getDetails();
    accountList.add(accountDetails);
    I was wondering how to accomplish the task of transfering values into a transfer object when invoking FindByPrimaryKey.
    I've taken a few stabs at it. My FindByPrimaryKey method doesn't throw any exceptions (as far as I can tell):
    try {
    Account account = accountHome.findByPrimaryKey(id);
    } catch (Exception ex) {
    throw new AccountNotFoundException("darn it - " + ex.getMessage());
    The error (which appears in the catalina log) occurs in the following section of code, which immediately follows the above:
    ArrayList myAccountDetails = new ArrayList();
    try {
    AccountDetails accountDetails = account.getDetails();
    myAccountDetails.add(accountDetails);
    } catch (RemoteException ex) {
    throw new EJBException("getDetails isn't working in AccountControllerBean: " + ex.getMessage());
    And here is the business method from Account:
    public AccountDetails getDetails() {
    return new AccountDetails(id, surname, firstname, balance);
    If any of the experts out there have spotted a mistake, I sure would be grateful for your help.
    James

    Thank you for your help. I think the ejbCreate method in the 'session facade' takes into account your advice:
    public void ejbCreate() {
    try {
    accountHome = EJBGetter.getAccountHome();
    } catch (Exception ex) {
    throw new EJBException("ejbCreate: " +
    ex.getMessage());
    account = null;
    accountId = null;
    I included your piece of code just the same to see if it would help anyway. Unfortunately the same error appeared in the catalina file.
    Also, there were error messages I hadn't noticed until now in the Verifier.
    One read:
    "No findByPrimaryKey method was found in home interface class [database.AccountHome]"
    The other:
    "No single argument findByPrimaryKey was found in home interface class [database.AccountHome]"
    Here is the method in the implementation class of the entity bean:
    public String ejbFindByPrimaryKey(String primaryKey)
    throws FinderException {
    boolean result;
    try {
    result = selectById(primaryKey);
    } catch (Exception ex) {
    throw new EJBException("ejbFindByPrimaryKey: " +
    ex.getMessage());
    if (result) {
    return primaryKey;
    else {
    throw new ObjectNotFoundException
    ("Row for id " + id + " not found.");
    Below is the 'selectById' method that it invokes:
    private boolean selectById(String primaryKey)
    throws SQLException {
    makeConnection();
    String selectStatement =
    "select id " +
    "from accountTable where id = ? ";
    PreparedStatement prepStmt =
    con.prepareStatement(selectStatement);
    prepStmt.setString(1, primaryKey);
    ResultSet rs = prepStmt.executeQuery();
    boolean result = rs.next();
    prepStmt.close();
    releaseConnection();
    return result;
    Here is what I have in the home interface of the entity bean for this find method:
    public Account findByPrimaryKey(String id)
    throws FinderException, RemoteException;
    In addition here is the entire method in the 'session facade':
    public ArrayList getAccount(String id)
    throws AccountNotFoundException, InvalidParameterException {
    if (id == null)
    throw new InvalidParameterException("null id");
    try {
    account = accountHome.findByPrimaryKey(id);
    } catch (Exception ex) {
    throw new AccountNotFoundException("dag it" + ex.getMessage());
    ArrayList accountList = new ArrayList();
    try {
    AccountDetails accountDetails = account.getDetails();
    accountList.add(accountDetails);
    } catch (RemoteException ex) {
    throw new EJBException("getDetails isn't working in Account ControllerBean: " + ex.getMessage());
    return accountList;
    Thanks again for helping me out.
    James

  • Copying value of objects, not reference?

    This has been bothering me for a while. I learned that when you set one object equal to another you are really just assigning the same reference to both, so that if one is altered they are both altered. Well, how can you set one object equal to the value of another but not the same reference so that altering one will not alter the other. My concern stems from returning arrays in methods. Since the reference itself is passed, any changes I make to the array are permanent, correct, and not just existing inside the method? So I was thinking maybe the best solution would be to use a tmp{] variable that is equal to the VALUE of the array I pass in, and then return that, so the original array is not altered in any way. Is this the customary practice for dealing with such situations? If not, what is typically done? Oh and just for future reference, because it might be of value to know, how DO I copy a value and not a reference? (and yes, that WAS on purpose ;) )

    violagirl23 wrote:
    My concern stems from passing arrays to [KRC] methods. Since the reference itself is passed, any changes I make to the array are permanent, correct, and not just existing inside the method? So I was thinking maybe the best solution would be to use a tmp{] variable that is equal to the VALUE of the array.Both georgemc and tschodt have already given you some good pointers, I'll try not to reiterate the same advise.
    This is an old "problem", discussed at length by folks much smarter than myself, and (IMHO) there still is no definitive question, let alone universal answer. What I mean is that sometimes this ability to modify the contents of a collection or array within a method is highly desirable; and sometimes of course it's just a source of bugs, when a noob calls your method not realising that it modifies the contents of the passed array (which shouldn't make it past unit testing anyway)... So, I think probably the best thing I can do for you is to give you the terms to google.
    What you're talking about is called a defensive copy... which, especially with arrays and collections, typically involves a deep copy (make a copy of every attribute of every object, all the way down the reference tree)... as apposed to Arrays.copyOf, which is a shallow copy, i.e. it just copies the references to the "top" objects.
    If you're writing a system from scratch you could decide to implement clone methods for everything you ever need to defensive copy. Cloning is ugly, no matter how you cook it. It requires every part of the class heirarchy being cloned to support the clone method (properly).
    In the past, I've tried to write a "generic" copy method, in the abstract-base-type of a class heirarchy using reflections. Everything I've tried has "pretty fatal" flaws. The only "proper" solution (AFAIK) is to just implement clone in every single frickin class... and that's a lot more "boiler plate" code than I personally think should be required to implement such a common, mundane task.
    Alternately, you could make all your data transfer objects immutable, so a shallow copy (Arrays.copyOf) of the array is enough to protect the calling code from unexpected changes to the array contents because you are passing "a copy" of the references to things-that-cannot-change... So the callee cannot mutate a pointed-to object, and if the callee changes which object an array element points-to, you won't "see" the change... and of course the callee cannot change which array your reference points to, because Java passes references by value.
    Google all the italic stuff... Sun's stuff is the best, then lookout for IBM's stuff, and most Wikipedia articles are really good (a few not so good).
    HTH. Cheers. Keith.

  • Passing values from a FORM to another FORM

    Hi,
    I have to pass values from FORM "A" to FORM "B". What is the best way to do this?\
    Can I use a GLOBAL variable?
    Thanks,
    Marc.

    I think he meant the global namespace.
    You set a :global_your_name_here to a value and that value is available in your entire application. See the help file section on the global namespace for more information.
    Forms parameters are parameters that you form picks up from the outside when it starts. The calling entity must supply them in the URL or they will be set to null. You set them up in the object navigator in the Parameters node.

  • Problem with value in object element declared as NUMBER(26,3)

    We have an object OBJ_NAME_1 created like below and total element in the object are around 100 with in which only one element is of data type VARCHAR2(4000). Other are with small size as below
    create or replace TYPE OBJ_NAME_1 AS OBJECT
    ( v_col1 VARCHAR2(4),
    v_col2 VARCHAR2(4),
    d_date DATE,
    amount_1 NUMBER(26,3) . . . . . . . . . . .)
    And we are creating an VARRY of above object as below:
    create or replace TYPE ARRAY_NAME_1 AS VARRAY(1000) OF OBJ_NAME_1
    Now we have one procedure with IN parameter of type ARRAY_NAME_1 as below and we are calling this procedure from java.
    create or replace PROCEDURE SP_PROC_1 (
    P_ARR_1 IN ARRAY_NAME_1,
    P_FILE IN VARCHAR2,
    E_MESS OUT VARCHAR2,
    E_CODE OUT NUMBER) . . . . . . . .
    My problem is with value of element amount_1 of array ARRAY_NAME_1 in the procedure. Actually data type of this element is NUMBER(26,3) in object. But from java we are able to pass value like 1234.12345 (with 5 decimal).
    The declare section of the procedure are like below :
    l_OBJ_NAME_1 OBJ_NAME_1;
    m_amount_1     table_1.amount_1%type; /* amount_1 in table_1 declared as NUMBER(26,3)*/
    n_amount_1     NUMBER(26,3);
    In the begin section we are assigning variable like below:
    IF (P_ARR_1 .COUNT>0) THEN
    FOR i IN P_ARR_1.FIRST .. P_ARR_1.LAST LOOP
    l_OBJ_NAME_1 := P_ARR_1(i);
    m_amount_1 := P_ARR_1(i).amount_1;
    n_amount_1 := P_ARR_1(i).amount_1;
    END LOOP;
    The value of variables are below after above assignment:
    l_OBJ_NAME_1 . Amount_1 → 234.12345 (without round off)
    m_amount_1 → 234.12345 (without round off)
    n_amount_1 → 234.123 (with round off)
    Actually all the above 3 variable/element has been declared as NUMBER(26,3), then the value in these variables should be with rounded up to 3 decimal place. Then why it is not happening with variable
    l_OBJ_NAME_1 . Amount_1 and m_amount_1?
    Please help.
    Edited by: SANT007 on Aug 12, 2011 9:45 AM

    Okay, thanks Patrick. I commented that out so now I can see the full error message. Actually, now the page just returns an "OK" (nothing else), and I click on that to return back to the page where I see:
    Checksum error for Hidden and Protected item ID (26968176992578859), value ([object]), posted checksum (326873D5A54A4AF425EC4D500B9B4D02), expected checksum (********************************), index_i (10), index_j (2), index_m (2);
    Okay, so that's evidently a new option in 3.1, it should have just been a 'Hidden' item, not 'Hidden and Protected'. So, I change this back to just 'Hidden', refressh the page, the re-execute it and try to select from the popup again. This time, instead of the more-or-less blank page with only "OK" on it, I also get "ORA-01722: invalid number" above the "OK". When I click the "OK", then I am returned back to the last good 'runnable' page I executed (since the search page is no longer 'runnable' (the javascript evidently is still returning an object instead of a number).
    On a previous run of trying to track the problem down, I made the :P3_SEQ as a regular text field so I could try to see what was going on, and it briefly displayed "[object]" before the search executed and returned the error.
    So thanks for helping me get past the first stage so I could see a better version of what the error is. Now I just need to figure out why an object is being returned instead of number. This worked fine in 3.0, and the only thing I can think of is that something, somewhere in 3.1's javascript is slightly different now, but I really don't know.
    Bill Ferguson

  • Transfer Object in JSF, Spring, and Hibernate

    The application on which I am working deploys the JavaServer Faces, Spring and Hibernate frameworks.
    We are going to use the "transfer object" to move data between J2EE tiers from the front end to the back end and vice versa. In addition, data "types" may need to be converted --
    At the front end, the "type" of the data that are entered by users may not match that in the database table. For example, checkboxes may be marked or left blank by users. The "type" of the checkboxes is "boolean" in the JSF backing bean. However, we have either "Y" or "N" for the corresponding field in the database table.
    The JSF backing bean holds data as well as controller functionality. Of course, the transfer object holds data only.
    With regard to class properties, Is the transfer object an exact copy of the JSF backing bean? And at which tier the data are converted to match their correspoding "types" in the database tables?
    We also have the "data objects" which are exact representation of database tables.
    Thanks for your advices.

    Small example: you can decide in the business layer
    whether to convert it to boolean or Boolean (which
    has a 3rd state: null).But it all goes back to your data model. If your data model supports null for that property, then of course boolean is a poor choice. If that case one could use Boolean. None of this has anything to do with re-usability, which was your objection.
    I think the re-usability question goes back to the data model as well. Suppose your data model says this property is boolean valued. However if your database does not support booleans natively, then you need to map the value for storage in the database. But that is the data persistence layers problem.
    OTOH, suppose your data model says that this property may be 'Y' or 'N'. Then the Java class represent the business object should not have a boolean property, we should make it match the data model.
    However, I think that most cases where people are storing 'Y' or 'N' in a field in the database fall into the first case, where the data model is a boolean and they are working around limitations in the database. There is no reason in that case to perpetuate the same limitations in the Java code.

Maybe you are looking for

  • Exception only occuring during stress test

    We are trying to get ready to release a beta version of the software I'm working on.. so part of getting ready for that was to try set up some stress tests and hit the server with multiple requests for the same page.... Not sure exactly how many it i

  • Photos not appearing in iphoto after sync

    Some of my imported photos from my iPhone 4 are not showing up in iPhoto.  The import was successful and I deleted them from my phone when prompted.  Could they be somewhere else on my computer?

  • How can i store a variable to a file?

    for some reason i can't find much on writing to files, is this not possible? and if it isnt possible, how can i keep a variable? i don't want the variable to reset to 0 every time someone loads a new instance of the page. also, for some reason.. it s

  • Monitor problem. Mouse scrolls the desktop or application

    I've just plugged my monitor back in, It's a Mitsubishi Diamond Pro 2070 SB (21 inch) and put the mouse in, but for some reason (i think rendering problems) the mouse moves the screen up and down and left and right even though it shouldn't? Does anyo

  • Solaris 11 hp dl 180 g6 - installer doesn't start

    Hi. I'm trying to install solaris 11 on an hp dl 180 g6 server. My main problem is that the installer cannot start - after 'Preparing disk image for use' I got 'Login services cabbot run' and it starts the maintenance mode. In this maintenance mode I