Creating an Array of a Complex Object Type

hi,
We have 5 different variables of a complex type(defined by an xsd).
We want to put the values from these 5 objects into a single array variable of the same complex type.
Is there any function in bpel to do this? Can we specify an element with a certain number of nodes (Array length)..
do let us know of any possible alternatives or solutions...
Looking forward to some replies on this one...
Thanks,
Vinod

Hi Vinod,
consider this.
<element name="Message">
<complexType>
<sequence>
<element name="someElement" type="xsd:string/>
<element name="someOtherElement" type="xsd:string/>
</sequence>
</complexType>
</element>
<element name="MessageArray">
<complexType>
<sequence>
<element name="Messages" type="Message" maxOccurs="unbounded" />
</sequence>
</complexType>
</element>
<variable name="Var1" type="client:Message"/>
<variable name="Var2" type="client:Message"/>
<variable name="Var3" type="client:Message"/>
<variable name="VarArray" type="client:MessageArray"/>
HTH
Mark

Similar Messages

  • Creating PL/SQL web services from object types

    Hello
    Jdeveloper, pl/sql web-services working successfully with object types.If we want to send the web-services to the client, do we need to send the entire folder that is created in the web-services folder of the external oc4j..?
    Creating the client process:
    we are using the wsdl file that is generated in the web-services and adding to the partner link to Invoke the operations of web-services. Is there any other way to invoke the webservices?Could any one please suggest me?
    Thanking you
    Malathi

    Hello
    Accessing the pl/sql webservices from the application server:
    I have created pl/sql webservice using the nested tables. This will insert the object data into database tables.after deplying the webservice into external oc4j, when I test the webservice locally with url: http://localmachine:8888/PL_SQL_WS-Nest_Obj_Webservice-context-root/ObjWebserviceSoapHttpPort
    The above web-services working and I am able to insert into the database tables.
    Same when I want to access through the application server, I have changed the wsdl file soap address as
    <soap:address location="http://10.91.20.7:8888/PL_SQL_WS-Nest_Obj_Webservice-context-root/ObjWebserviceSoapHttpPort"/>
    When I access this url, I am able to give the input data
    http://10.91.20.7:8888/PL_SQL_WS-Nest_Obj_Webservice-context-root/ObjWebserviceSoapHttpPort
    but the out from the web-service is:
    <env:Envelope
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Header/>
    <env:Body>
    <env:Fault
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <faultcode>env:Server</faultcode>
    <faultstring>Error creating target: DBConnImpMftest.ObjWebserviceUser</faultstring>
    <faultactor/>
    </env:Fault>
    </env:Body>
    </env:Envelope>
    Err from the OC4j log:<PAYLOAD>
    <MSG_TEXT>An error occurred for port: {http://dbconnimpmftest/Nested_Webserv.wsdl}Nested_WebservSoapHttpPort: javax.xml.rpc.JAXRPCException: Error creating target: dbconnimpmftest.Nested_WebservUser.</MSG_TEXT>
    </PAYLOAD>
    Could any one help me to solve the above issue?
    Kind regards
    Malathi

  • How to set an array element in an object type of array??

    Hi,
    I have set attribute as follow:
    Color[] colors;
    Color[] colors = new Color[20];
    colors[0] = "Red";
    colors[1] = "blue";I can't compile this code. It said:
    "Incompatible type -found java.lang.String but expected Colors
    Could you tell me how to set an array elements when the array type is an object?

    in your case, the array shouldn't be Color[] but String[] since you re intending to put strings into it
    by the way, you could also use a hashmap to map a string to a color:
    HashMap<String, Color> hm = new HashMap<String, Color>();
    hm.put("Red", Color.RED);
    hm.put("Blue", Color.BLUE);
    etc.

  • Physical service to invoke Oracle stored procedure taking an object type

    Hello,
    I have some stored procedures in Oracle that take a complex object type as parameters. Can I invoke these directly from ODSI? If so, how do I create the physical service for this?
    Example:
    CREATE OR REPLACE TYPE "CCSUSERDV"."TEST_TYPE" as object (
    name varchar2(80),
    text varchar2(1000),
    some_other number
    CREATE OR REPLACE PACKAGE CCSUSERDV.TEST
    as
    function joinText(inVal in TEST_TYPE) return varchar2;
    end;
    CREATE OR REPLACE PACKAGE BODY CCSUSERDV.TEST
    AS
    FUNCTION joinText(inVal in TEST_TYPE) return varchar2 AS
    BEGIN
    if (inVal.text is not null) then
    return inVal.name || '-' || inVal.text;
    else
    return inVal.name || ':' || inVal.some_other;
    end if;
    END;
    END;
    I Want to be able to call TEST.joinText from OSDI. I know I could create a separate function that takes all the attributes of my object, but it would be considerably more convenient to implement in terms of the object instead, because there are several functions that take the same set of about 20 fields as a request.
    Thank you!!
    Jeff

    (1) Your best bet is to create a wrapper stored procedure that takes simple arguments and constructs the object, then calls your stored procedure with the object. You call the wrapper stored procedure from ODSI. JPublisher can create wrapper stored procedures for you.
    (2) If it is impossible for you to create a wrapper stored procedure in the database, you can create a physical data service from the existing stored procedure. You will notice that the function in the physical data service will have simple arguments (not the object), and if you try to execute it, it will fail. It's up to you to write an anonymous pl/sql block that wraps the existing stored procedure (basically what you would have had to write for (1)), and edit the metadata in the physical ds - where it has the name of the stored procedure, replace the name with your anonymous PL/SQL block.
    Below is what the CREATE_BATCH stored procedure from Oracle Process Manufacturing would look like. (it also has CURSOR args - so it is uglier than just Objects). It also demonstrates that you need to do a conversion of boolean args.
    xquery version "1.0" encoding "WINDOWS-1252";
    (::pragma xds <x:xds xmlns:x="urn:annotations.ld.bea.com" targetType="t:CERTIFY_BATCH" xmlns:t="ld:JdbcTest4DataServices/opm/CERTIFY_BATCH">
    <creationDate>2007-01-14T20:55:37</creationDate>
    <relationalDB dbVersion="10" dbType="oracle" name="oracleXeDataSource"/>
    </x:xds>::)
    declare namespace f1 = "ld:JdbcTest4DataServices/opm/CERTIFY_BATCH";
    import schema namespace t1 = "ld:JdbcTest4DataServices/opm/CERTIFY_BATCH" at "ld:JdbcTest4DataServices/opm/schemas/CERTIFY_BATCH.xsd";
    (::pragma function <f:function xmlns:f="urn:annotations.ld.bea.com" kind="read" nativeName="DECLARE p_batch_header gme_batch_header%rowtype; x_batch_header gme_batch_header%rowtype; x_unallocated_material gme_api_pub.unallocated_materials_tab; TYPE rc IS REF CURSOR; PROCEDURE to_ref_cursor(x IN gme_api_pub.unallocated_materials_tab, ref_cursor IN OUT rc) IS l_data bea_unallocated_materials_tab := bea_unallocated_materials_tab(); BEGIN FOR i IN x.FIRST .. x.LAST LOOP l_data.EXTEND; l_data(i) := bea_unallocated_materials_type(x(i).batch_id, x(i).batch_no, x(i).material_detail_id, x(i).line_type, x(i).line_no, x(i).item_id, x(i).item_no, x(i).alloc_qty, x(i).unalloc_qty, x(i).alloc_uom); END LOOP; OPEN ref_cursor FOR SELECT * FROM TABLE ( CAST (l_data AS bea_unallocated_materials_tab) ); END; FUNCTION to_boolean(n IN NUMBER) RETURN BOOLEAN IS BEGIN IF (n = 0) THEN RETURN FALSE; ELSE RETURN TRUE; END IF; END to_boolean;BEGIN p_batch_header.batch_id := ?; p_batch_header.batch_no := ?; p_batch_header.plant_code := ?; p_batch_header.batch_type := ?; p_batch_header.actual_start_date := ?; p_batch_header.actual_cmplt_date := ?; gme_api_pub.certify_batch( p_api_version => ?, p_validation_level => ?, p_init_msg_list => to_boolean(?), p_commit => to_boolean(?), x_message_count => ?, x_message_list => ?, x_return_status => ?, p_del_incomplete_manual => to_boolean(?), p_ignore_shortages => to_boolean(?), p_batch_header => p_batch_header, x_batch_header => x_batch_header, x_unallocated_material => x_unallocated_material ); ? := x_batch_header.batch_id; ? := x_batch_header.batch_no; ? := x_batch_header.plant_code; ? := x_batch_header.batch_type; ? := x_batch_header.actual_start_date; ? := x_batch_header.actual_cmplt_date; ? := x_batch_header.plan_start_date; ? := x_batch_header.plan_cmplt_date; ? := x_batch_header.due_date; ? := x_batch_header.recipe_validity_rule_id; ? := x_batch_header.wip_whse_code; to_ref_cursor(x_unallocated_material, ?);END;" nativeLevel2Container="" nativeLevel3Container="" style="storedProcedure">
    <params xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes" xmlns:pn1="ld:JdbcTest4DataServices/opm/CERTIFY_BATCH" >
    <param name="BATCH_ID" kind="in" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="BATCH_NO" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="PLANT_CODE" kind="in" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="BATCH_TYPE" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="ACTUAL_START_DATE" kind="in" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="ACTUAL_CMPLT_DATE" kind="in" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="P_API_VERSION" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="P_VALIDATION_LEVEL" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="P_INIT_MSG_LIST" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="P_COMMIT" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="X_MESSAGE_COUNT" kind="out" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="X_MESSAGE_LIST" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="X_RETURN_STATUS" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="P_DEL_INCOMPLETE_MANUAL" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="P_IGNORE_SHORTAGES" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="BATCH_ID" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="BATCH_NO" kind="out" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="PLANT_CODE" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="BATCH_TYPE" kind="out" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="ACTUAL_START_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="ACTUAL_CMPLT_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="PLAN_START_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="PLAN_CMPLT_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="DUE_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="RECIPE_VALIDITY_RULE_ID" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="WIP_WHSE_CODE" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="X_UNALLOCATED_MATERIAL" kind="out" xqueryType="pn1:X_UNALLOCATED_MATERIAL_ROW" nativeTypeCode="-10" nativeType="REF CURSOR"/>
    </params>
    </f:function>::)
    declare function f1:CERTIFY_BATCH($p_batch_header_batch_id as xsd:string, $p_batch_header_batch_no as xsd:decimal, $p_batch_header_plant_code as xsd:string, $p_batch_header_batch_type as xsd:decimal, $p_batch_header_actual_start_date as xsd:dateTime, $p_batch_header_actual_cmplt_date as xsd:dateTime, $p_api_version as xsd:decimal, $p_validation_level as xsd:decimal, $p_init_msg_list as xsd:integer, $p_commit as xsd:integer, $p_del_incomplete_manual as xsd:integer, $p_ignore_shortages as xsd:integer) as schema-element(t1:CERTIFY_BATCH) external;

  • Report based on Object Types

    Hi All,
    I am using Oracle 9i & Developer 6i on Windows platform in client/server environment. I created a report based on an Object Type defined in the Database. I am facing two problems in that:
    1. Its not picking up Date columns properly. When I run the report, I receive error: "REP-0612: Invalid Date Mask.
    ORA-01801: date format is too long for internal buffer.".
    When I checked, I noticed that all the date columns in my Data Model, which are coming from Object Type are of Width 9 only. I want to ask how is it so, & how can I sort it out. I have not specified any format model for dates neither in Object Type nor in Report anywhere.
    2. Another thing is, after reopening the report, in the report builder, i mean closing & then opening the .rdf file, when I try to run the report, I receive following error: "REP-0499: Column 'Column_Name' selected by the query is incompatible with report defination". This column is one of the columns/attributes of the object type on which my report is based. Though, nothing has been changed in the object type or any other database object, it gives this error, everytime, I try to run the report, after closing it(after proper saving) & opening it again. Can anyone help me by telling, why is it happening like this.
    Thanks in Advance,
    Inderjeet Singh

    Thanks for the quick reply InoL,
    I'm not familiar with breakOrder, however when I review the code behind the report, I see nothing but:
    breakOrder="none" in several lines. There is no other value other than "none" for this setting. Here's an excerpt:
    "Group Name" breakOrder="none".
    What exactly does breakOrder control and what other values are possible?
    As far as pageProtect goes, there are two entries that show:
    <generalLayout pageProtect="yes" verticalElasticity="variable"/>
    Is it worth a shot to change both to "no" to see what happens?
    Thanks,
    Dave

  • Asset - Equipment Synchronization (Object type)

    Hi Experts,
    In our system, Asset-Equipment synchronization is activated. An equipment will be automatically created upon creation of an Asset.
    Asset Class(Eg: 10006) is sync with Equipment category(eg : M) and equipment are created automatically. A set of Evaluation group 1(Eg: F001,F002, F003,F004,F005) are defined and Equipment Object types (Eg; F001, F002, F003) are defined for selected corresponding evaluation group 1 values
    It is required to create equipment ONLY for those selected Object types (Eg; F001, F002, F003). Equipment should not be created for all.
    Config allows to add one object type for Asset Class-Equipment category combination
    How should i add more object types to same Asset Class-Equipment category combination?
    i.e. :
    Asset Class : 10006
    Equipcategory: M
    Object Type: F002
    Asset Class : 10006
    Equipcategory: M
    Object Type: F003
    Is it possible to do so...
    Appreciate your guidance

    Dear Sank
    Standard Method: It is 1:1:1 assignment for Asset Class, Equipment Category and Object type.
    Note that an asset class can be assigned at most to one combination of equipment category and object type. On the other hand, more than one asset class can assigned to the same combination.
    However you can maintain Asset class and Equipment category assignment without any object type assignment so you would be able to create equipmetnts for all object types with specified equipment category.
    User exits: AAPM0001 can be looked into to suit your requirement
    Also look into SAP Note:  370884 - PM-AA 4.6C: Consulting on sync activation + corrections
    Rgrds
    Murad

  • CE7.1 SP3/SP4 Application service - complex return type

    Hi all,
    can anybody tell me how to create an operation with a complex return type (collection) within an application service.I can't find it in the documentation!
    I would appreciate helpful answers.
    BR,
    Martin

    Hi,
    It isnt that tough ... following are the steps ..
    Suppose you want to return a list of customers. First create a structure "Customer". Once that is done create another structure "CustomerList" ... now add "Customer" to it as the attribute. Set the cardinality of this "Customer" attribute as 0-n or 1-n ...
    Thats it .. Hope this helps.
    Ashutosh

  • Displaying value of Object type

    Hi All,
    I have created one type as Object and I am trying to display the values available in object type for debugging purpose. Please assist me to display the contents of object type.
    Thanks in Advance.
    Regards,
    Venkatesh S

    vivekan wrote:
    I have created one type as Object and I am trying to display the values available in object type for debugging purpose. Please assist me to display the contents of object type.You can do this statically or dynamically.
    The static approach would be to add a DebugDump() method to the object type class - and code this method to display a "debug dump" (via DBMS_OUTPUT for example) of the current instantiated object. Of course, should the class change (new attributes added for example), this DebugDump() method has to be updated.
    The dynamic method is more flexible - but requires a copy of the object to be created for the dynamic code to use and "dump".
    As the static method is pretty straightforward, I'm only providing a basic example of the dynamic method.
    // create a function that generates a PL/SQL anonymous code block that accepts the
    // object to dump as bind variable and the display the object's attributes
    SQL> create or replace function GenerateDumpCode( typeName varchar2 ) return varchar2 is
      2          LF_INDENT       constant varchar2(10) default chr(10)||chr(9);
      3          LF              constant varchar2(10) default chr(10);
      4          type TAttrList is table of user_type_attrs.attr_name%Type;
      5          type TAttrTypeList is table of user_type_attrs.attr_type_name%Type;
      6          attrName        TAttrList;
      7          attrType        TAttrTypeList;
      8          plCode          varchar2(32767);
      9  begin
    10          select
    11                  a.attr_name, a.attr_type_name
    12                          bulk collect into
    13                  attrName, attrType
    14          from    user_type_attrs a
    15          where   a.type_name = typeName
    16          order by
    17                  a.attr_no;
    18 
    19          plCode :=
    20  'declare
    21          obj '||typeName||';
    22 
    23          procedure W( line varchar2 ) is
    24          begin
    25                  DBMS_OUTPUT.put_line( line );
    26          end;
    27  begin
    28          obj := :var1;
    29  ';
    30 
    31          for i in 1..attrName.Count loop
    32                  plCode := plCode ||LF_INDENT|| 'W( ''Attribute '||attrName(i)||'=''||';
    33                  case attrType(i)
    34                          when 'NUMBER' then plCode := plCode || 'to_char(obj.'||attrName(i)||') );';
    35                          when 'INTEGER' then plCode := plCode || 'to_char(obj.'||attrName(i)||') );';
    36                          when 'VARCHAR2' then plCode := plCode || 'obj.'||attrName(i)||' );';
    37                          when 'DATE' then plCode := plCode || 'to_date(obj.'||attrName(i)||',''yyyy/mm/dd hh24:mi:ss'') );';
    38                  else
    39                          plCode := plCode || '''data type '||attrType(i)||': value not displayed.'');';
    40 
    41                  end case;
    42          end loop;
    43 
    44          plCode := plCode ||LF|| 'end;';
    45 
    46          return( plCode );
    47  end;
    48  /
    Function created.
    // we need a sample object type/class for, so here's a basic one
    SQL> create or replace type TFunkyFoo is object(
      2          day             date,
      3          empID           integer,
      4          empName         varchar2(20),
      5          contract        clob
      6  );
      7  /
    Type created.
    // the dynamic code block that the function will generate looks as follows:
    SQL> select GenerateDumpCode( 'TFUNKYFOO' ) as PLSQL_CODE from dual;
    PLSQL_CODE
    declare
            obj TFUNKYFOO;
            procedure W( line varchar2 ) is
            begin
                    DBMS_OUTPUT.put_line( line );
            end;
    begin
            obj := :var1;
            W( 'Attribute DAY='||to_date(obj.DAY,'yyyy/mm/dd hh24:mi:ss') );
            W( 'Attribute EMPID='||to_char(obj.EMPID) );
            W( 'Attribute EMPNAME='||obj.EMPNAME );
            W( 'Attribute CONTRACT='||'data type CLOB: value not displayed.');
    end;
    // using the function to dynamically display an object's attributes
    SQL> declare
      2          foo TFunkyFoo;
      3  begin
      4          foo := new TFunkyFoo( sysdate, 100, 'John Smith', null );
      5          execute immediate
      6                  GenerateDumpCode( 'TFUNKYFOO' )
      7          using   foo;
      8  end;
      9  /
    Attribute DAY=2012-08-30 14:48:35
    Attribute EMPID=100
    Attribute EMPNAME=John Smith
    Attribute CONTRACT=data type CLOB: value not displayed.
    PL/SQL procedure successfully completed.
    SQL>

  • Can we create an associative array of Object type Column

    Hi All,
    I have a scenario where there are many PLSQL Types passed as IN and OUT params in a procedure. Since the Java cannnot access these types, we've plannned to create Object types.
    However the can we create one Object type as below:
    create or replace type T_EMP_REC as object
    emp_id number(8),
    dept_id number(8),
    emp_name varchar2(50),
    Then now I want to create an array of T_EMP_REC.emp_id and others respectively. Is this possible.
    The reason for doing this is, that we may get many emp_id, dept_id and emp_name for a condition and hence pass on the same to Java application.
    Please share your thoughts to achieve for such scenario. Any pseudo or code logic is much helpful.
    Regards,

    Hi,
    Sorry, this is forum is intended only for SQL Developer tool questions.
    If you wish to pursue your question, mark this thread as answered and repost in the SQL and PL/SQL forum:
    PL/SQL
    Thanks,
    Gary

  • How to convert an array collection instance to a complex object for interaction with webservice

    Hi there,
    I have a stubborn problem that I am trying to work out the best way to solve the problem.  I am interacting with a WebService via HTTPService calling a method called find(String name) and this returns me a List of ComplexObjects that contain general string and int params and also lists of other Complex Objects.  Now using the code:
    ArrayCollection newOriginalResultsArray = new ArrayCollection(event.result as Array)
    flex converts my complex objects results to an arraycollection so that I can use it in datagrids etc.  Now up until this part is all good.  My problem is when getting a single instance from the results list, updating it by moving data around in a new datagrid for example - I want to interact with the webservice again to do an create/update.  This is where I am having problems - because these webservice methods require the complex object as a parameter - I am struggling to understand how I can convert the array collection instance back to my complex object without iterating over it and casting it back (maybe this is the only way - but I am hoping not).
    I am hoping that there is a simple solution that I am missing and that there is some smart cookie out there that could provide me with an answer - or at least somewhere to start looking. I guess if I have no other alternative - maybe I need to get the people who built the service to change it to accept an array - and let them do the conversion.
    Any help would be greatly appreciated.
    Bert

    Hi Bert,
    According to my knowledge you can use describeType(Object) method which will return an XML... That XML will contain Properties and values just iterate through the XML and create a new Object..   Probably u can use this method...
    public function getObject(reqObj:Object,obj:Object,instanceName:String,name:String=null,index:int=-1):Obj ect
                if(!reqObj)
                    reqObj = new Object();
                var classInfo:XML = describeType(obj);
                var className:String = instanceName;
                if(name!=null)
                    className=name+"."+className;
                if(index!=-1)
                    className=className+"["+index+"]";
                for each (var v:XML in classInfo..accessor)
                    var attributeName:String=v.@name;
                    var value:* = obj[attributeName]
                    var type:String = v.@type;
                    if(!value)
                        reqObj[className+"."+attributeName] = value; 
                    else if(type == "mx.collections::ArrayCollection")
                        for(var i:int=0;i<value.length;i++)
                            var temp:Object=value.getItemAt(i);
                            getReqObject(reqObj,temp,attributeName,className,i);
                    else if(type == "String" || type == "Number" || type == "int" || type == "Boolean")
                        reqObj[ className+"."+attributeName] = value; 
                    else if (type == "Object")
                        for (var p:String in value)
                            reqObj[ className+"."+attributeName+"."+p] = value[p];
                    else
                        getReqObject(reqObj,value,attributeName,className);
                return reqObj;
    Thanks,
    Pradeep

  • Invoking stored procedure that returns array(oracle object type) as output

    Hi,
    We have stored procedures which returns arrays(oracle type) as an output, can anyone shed some light on how to map those arrays using JPA annotations? I tried using jdbcTypeName but i was getting wrong type or argument error, your help is very much appreciated. Below is the code snippet.
    JPA Class:
    import java.io.Serializable;
    import java.sql.Array;
    import java.util.List;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import org.eclipse.persistence.annotations.Direction;
    import org.eclipse.persistence.annotations.NamedStoredProcedureQuery;
    import org.eclipse.persistence.annotations.StoredProcedureParameter;
    * The persistent class for the MessagePublish database table.
    @Entity
    @NamedStoredProcedureQuery(name="GetTeamMembersDetails",
         procedureName="team_emp_maintenance_pkg.get_user_team_roles",
         resultClass=TeamMembersDetails.class,
         returnsResultSet=true,
         parameters={  
         @StoredProcedureParameter(queryParameter="userId",name="I_USER_ID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="employeeId",name="I_EMPLOYEEID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="TEAMMEMBERSDETAILSOT",name="O_TEAM_ROLES",direction=Direction.OUT,jdbcTypeName="OBJ_TEAM_ROLES"),
         @StoredProcedureParameter(queryParameter="debugMode",name="I_DEBUGMODE",direction=Direction.IN,type=Long.class)
    public class TeamMembersDetails implements Serializable {
         private static final long serialVersionUID = 1L;
    @Id
         private long userId;
         private List<TeamMembersDetailsOT> teamMembersDetailsOT;
         public void setTeamMembersDetailsOT(List<TeamMembersDetailsOT> teamMembersDetailsOT) {
              this.teamMembersDetailsOT = teamMembersDetailsOT;
         public List<TeamMembersDetailsOT> getTeamMembersDetailsOT() {
              return teamMembersDetailsOT;
    Procedure
    PROCEDURE get_user_team_roles (
    i_user_id IN ue_user.user_id%TYPE
    , o_team_roles OUT OBJ_TEAM_ROLES_ARRAY
    , i_debugmode IN NUMBER :=0)
    AS
    OBJ_TEAM_ROLES_ARRAY contains create or replace TYPE OBJ_TEAM_ROLES_ARRAY AS TABLE OF OBJ_TEAM_ROLES;
    TeamMembersDetailsOT contains the same attributes defined in the OBJ_TEAM_ROLES.

    A few things.
    You are not using a JDBC Array type in your procedure, you are using a PLSQL TABLE type. An Array type would be a VARRAY in Oracle. EclipseLink supports both VARRAY and TABLE types, but TABLE types are more complex as Oracle JDBC does not support them, they must be wrapped in a corresponding VARRAY type. I assume your OBJ_TEAM_ROLES is also not an OBJECT TYPE but a PLSQL RECORD type, this has the same issue.
    Your procedure does not return a result set, so "returnsResultSet=true" should be "returnsResultSet=false".
    In general I would recommend you change your stored procedure to just return a select from a table using an OUT CURSOR, that is the easiest way to return data from an Oracle stored procedure.
    If you must use the PLSQL types, then you will need to create wrapper VARRAY and OBJECT TYPEs. In EclipseLink you must use a PLSQLStoredProcedureCall to access these using the code API, there is not annotation support. Or you could create your own wrapper stored procedure that converts the PLSQL types to OBJECT TYPEs, and call the wrapper stored procedure.
    To map to Oracle VARRAY and OBJECT TYPEs the JDBC Array and Struct types are used, these are supported using EclipseLink ObjectRelationalDataTypeDescriptor and mappings. These must be defined through the code API, as there is currently no annotation support.
    I could not find any good examples or doc on this, your best source of example is the EclipseLink test cases in SVN,
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/plsql/
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/customsqlstoredprocedures/
    James : http://www.eclipselink.org

  • Require help on Array of Nested tables and Oracle Object type

    Hi All,
    I have a scenario where I have some millions of records received from a flat file and the record is stored in Table as below:
    Tablename: FILE_RECORD
    Rows:
    FILE_REG_ID = 1
    RECORD_NBR = 1     
    PROCESSED_IND = U
    RECORD= 00120130326006A
    FILE_REG_ID = 1
    RECORD_NBR = 2     
    PROCESSED_IND = U
    RECORD= 00120130326003
    1) I have to read these records at once and
    a) Split the RECORD column to get various other data Eg: Fld1=001, Fld2=20130326, Fld3 = 003
    b) send as an Array to Java.
    2) Java will format this into XML and sent to other application.
    3) The other application returns a response as Successful or Failure to Java in XML
    4) Java will send RECORD_NBR and the corresponding response as Success or Failure back to PLSQL
    5) PLSQL should match the RECORD_NBR and update the PROCESSED_IND = P.
    I 'm able to achieve this using SQL Table type by creating a TYPE for Each of the fields (Flds) however the problem is Java cannot Access the parameters as the TYPE are of COLUMN Types
    Eg: For RECORD_NBR
    SUBTYPE t_record_nbr IS FILE_RECORD.T010_RECORD_NBR%TYPE;
    Can you please let me know how I can achieve this to support Java, I know one way that is by creating an OBJECT TYPE and a TABLE of the OBJECT TYPE.
    Eg: T_FILE_RECORD_REC IS OBJECT
    FILE_REG_ID number(8), RECORD_NBR number (10), PROCESSED_IND varchar2(1), RECORD varchar(20)
    Create type T_FILE_RECORD_TAB IS TABLE OF T_FILE_RECORD_REC
    However I'm facing a problem to populate an Array of records, I know I'm missing something important. Hence please help.
    It would be helpful to provide some guidelines and suggestions or Pseudo or a Code to achieve this. Rest all I can take up further.
    Thanks in advance,

    I know once way that is creating a OBJECT TYPE and a TABLE of OBJECT TYPE, howeve I feel I'm missing something to achieve this.You're right, you need SQL object types created at the database level. Java doesn't know about locally defined PL/SQL types
    However you can do without all this by creating the XML directly in PL/SQL (steps 1+2) and passing the document to Java as XMLType or CLOB.
    Are you processing the records one at a time?

  • How to create an array with Generic type?

    Hi,
    I need to create a typed array T[] from an object array Object[]. This is due to legacy code integration with older collections.
    The method signature is simple:public static <T> T[] toTypedArray(Object[] objects)I tried using multiple implementations and go over them in the debugger. None of them create a typed collection as far as I can tell. The type is always Object[].
    A simple implementation is just to cast the array and return, however this is not so safe.
    What is interesting is that if I create ArrayList<String>, the debugger shows the type of the array in the list as String[].
    If I create ArrayList<T>, the class contains Object[] and not T[].
    I also triedT[] array = (T[]) Array.newInstance(T[].class.getComponentType(), objects.length);And a few other combinations. All work at runtime, create multiple compilation warnings, and none actually creates T[] array at runtime.
    Maybe I am missing something, but Array.newInstace(...) is supposed to create a typed array, and I cannot see any clean way to pass Class<T> into it.T[].class.getComponentType()Returns something based on object and not on T, and T.class is not possible.
    So is there anything really wrong here, or should I simply cast the array and live with the warnings?
    Any help appreciated!

    Ok. May be you could keep information about generic type in the your class:
    public class Util {
        public static <T> T[] toTypedArray(Class<T> cls, Object[] objects){
            int size = objects.length;
            T[] t = (T[]) java.lang.reflect.Array.newInstance(cls, size);
            System.arraycopy(objects, 0, t, 0, size);
            return t;
    public class Sample<T> {
        Class<T> cls;
        T[] array;
        public Sample(Class<T> cls) {
            this.cls = cls;
        public void setArray(Object[] objects){
            array = Util.toTypedArray(cls, objects);
        public T[] getArray(){
            return array;
        public static void main(String[] args) {
            Object[] objects = new Object[] { new LinkedList(), new ArrayList()};
            Sample<List> myClass = new  Sample<List>(List.class);
            myClass.setArray(objects);
            for(List elem: myClass.getArray()){
                System.out.println(elem.getClass().getName());
    }

  • Get database result as a type of complex object

    Hi,
    I would like to make a query and send the results with web service to the client by a user defined object type. I send the servis and client code below. My query works fine but I got all array elements of my object equal to null. I could not understand the reason.
    Could you look and help me to solve it please?
    Server Code:
    import com.sun.rowset.CachedRowSetImpl;
    import java.sql.SQLException;
    public class deneme3 {
    public datayeni hesapla(datayeni don){
    int counter = 0;
    CachedRowSetImpl crs=null;
    SQLInterface iface = new SQLInterface();
    if (!iface.execQuery("SELECT isim, soyisim, email, " +
    "kart FROM musteri"))
    System.exit(1);
    // create CachedRowSet and output data to object data
    try
    crs = new CachedRowSetImpl();
    crs = iface.getRowSet();
         if(crs != null)
         while (crs.next())
         counter++;
         int j = 1;     
         int i = 0;                         
         don.setisim(i,crs.getString(j++)) ;
         System.out.println (don.getisim(i));
         don.setsoyisim(i,crs.getString(j++)) ;
         System.out.println (don.getsoyisim(i));
         don.setemail(i,crs.getString(j++)) ;
         System.out.println (don.getemail(i));
         don.setkart(i,crs.getString(j++)) ;
         System.out.println (don.getkart(i));          
         i++;
    } catch (SQLException se) {        
         return don;
    The Client Code:
    import org.apache.axis.AxisFault;
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    import org.apache.axis.utils.Options;
    import javax.xml.namespace.QName;
    import javax.xml.rpc.ParameterMode;
    public class deneme3_Client {
    public static void main(String [] args) throws Exception {
    Options options = new Options(args);
    String ad[]=new String[10];
    String soyad[]=new String[10];
    String eposta[]=new String[10];
    String card[]=new String[10];
    datayeni obje_return = new datayeni();
    Service service = new Service();
    Call call = (Call) service.createCall();
    QName qn = new QName( "urn:BeanService", "datayeni" );
    call.registerTypeMapping(datayeni.class, qn,
    new org.apache.axis.encoding.ser.BeanSerializerFactory(datayeni.class, qn),
    new org.apache.axis.encoding.ser.BeanDeserializerFactory(datayeni.class, qn));
    call.setTargetEndpointAddress( new java.net.URL(options.getURL()) );
    call.setOperationName( new QName("deneme3", "hesapla") );
    call.addParameter( "arg1", qn, ParameterMode.INOUT );
    call.setReturnType( qn );
    datayeni ret = new datayeni();
    obje_return = (datayeni) call.invoke( new Object[] {obje_return} );
    int i = 0;
    for (i = 0;i<4;i++)
         ad[i] = obje_return.getisim(i);
         System.out.println(ad);     
         soyad[i] = obje_return.getsoyisim(i);
         System.out.println(soyad[i]);
         eposta[i] = obje_return.getemail(i);
         System.out.println(eposta[i]);
         card[i] = obje_return.getkart(i);
         System.out.println(card[i]);
    And the code for the class datayeni:
    public class datayeni{
    //attributes
    private String isim[]=new String[10];
    private String soyisim[]=new String[10];
    private String email[]=new String[10];
    private String kart[]=new String[10];
    //setter methods
    public void setisim (int index,String isim)
         this.isim[index] = isim;
    public void setsoyisim (int index,String soyisim)
         this.soyisim[index] = soyisim;
    public void setemail (int index,String email)
         this.email[index] = email;
    public void setkart (int index,String kart)
         this.kart[index] = kart;
    //getter methods
    public String getisim(int index)
         return this.isim[index];
    public String getsoyisim(int index)
         return this.soyisim[index];
    public String getemail(int index)
         return this.email[index];
    public String getkart(int index)
         return this.kart[index];
    Thank You!!!

    I really wonder, how ur code got compiled ...
    Try removing this four lines from ur clinet side code:
    String ad[]=new String[10];
    String soyad[]=new String[10];
    String eposta[]=new String[10];
    String card[]=new String[10];Now
    your all get methods return String...but u are assigning that string to
    array of strings like :
    ad = obje_return.getisim(i);
    soyad = obje_return.getsoyisim(i);
    eposta = obje_return.getemail(i);
    card = obje_return.getkart(i);instead write it like this:
    String ad = obje_return.getisim(i);
    String soyad = obje_return.getsoyisim(i);
    String eposta = obje_return.getemail(i);
    String card = obje_return.getkart(i);If above thing doesnt work ....
    I am very sure problem is not with webservice..its between jumbling of string/int and arrays of respective...
    because when u define new array of objects(in ur case: array of Strings), all newborn strings are initlialized to null.

  • How to create required object types manually ?

    Hi all,
    I got this XML schema entry:
    <xs:element name="Chapters"
    minOccurs="0"
    maxOccurs="1"
    xdb:SQLName="CHAPTERS"
              xdb:SQLType="XDB_CHAPTERS_TYPE">
    <xs:complexType>
    <xs:sequence>
    <xs:element name="Chapter"
              xdb:SQLName="CHAPTER"
    xdb:SQLCollType="XDB_CHAPTERS_COLLECTION"               
                   minOccurs="1"
                   maxOccurs="unbounded"
                   xdb:SQLType="XDB_CHAPTER_DETAILS_TYPE">
         <xs:complexType>
              <xs:simpleContent>
              <xs:extension base="xs:string">
              <xs:attribute name="No"
                        type="xs:positiveInteger"
                        xdb:SQLName="NO"/>
              </xs:extension>
              </xs:simpleContent>
         </xs:complexType>
         </xs:element>
         </xs:sequence>
         </xs:complexType>
    </xs:element>
    which results in this entry in a XML file:
    <Chapters>
    <Chapter No="12">The Longest Time</Chapter>
    </Chapters>
    Question: How do I have to create the corresponding object type, which is required for XML schema registration ?
    Any help is appreciated...
    Regards Markus

    Hi Markus
    I don't know why you want to manually creates the types... anyway since it can by quite complex to write all CREATE TYPE statement for a real schema... here my suggestion:
    1) activate a tracing with the following statement
    ALTER SESSION SET EVENTS '31098 TRACE NAME CONTEXT FOREVER'
    2) register the schema with GENTYPES=&gt;TRUE
    3) in a trace file under UDUMP you find all the statements executed, therefore the CREATE TYPE as well
    4) use these statement as basis for your scripts
    Chris

Maybe you are looking for

  • How do you retrieve notes previously written as they seem to delete themselves and I am losing work

    I have twice lost notes in the past week as the system seems to be deleting them. Any ideas why? Had a techi person look at it (who should know about iPads) but he couldn't help either. Getting so frustrated as losing hours of work.

  • Install ASM on Solaris RAC 10g

    Hello, I installed CRS and database software on two nodes RAC 10.2.0.4 Solaris x86-64 5.10, latest updates for Solaris. I have no error with crs. Problems description: 1) When I run DBCA to create ASM it fails to create it on the nodes, with error OR

  • Scan as a jpeg

    I have an officejet 6815.  When I scan something it saves it as a PDF and  need it to be a jpeg.  I cant figure out how to change that.  When I scan something,half the time it is so I can manupulate it.  I dont have a program that can alter a PDF.  v

  • Newbie flash question

    I was thinking about a way to create a opening page for our club website. I would like to have some images fade in, and out, with sounds, etc, and give visitors a way to bypass that (if they want) and head right to the main page with info. So, based

  • Is it possible to have text messages delated from outside sorces such as a hacker?

    I have text messages missing from my cell. Is it possible for someone to hack into my Android and delete messages?