How to return array of object

public class A{
public class B{
publc C[] sample()
int i=0;
ResultSet rset = s.executeQuery("select name, id  from emp ");
while(rs.next()){
name = rset.getString("nam");
id = rset.getInt("id");
c.setName(name )
c[i].setId(id)
return c[]
public class C{
// here i have getter and setter metod for name & id
When I try to return the object c[]..i am getting "cannot conver from C to C[]".
Can u pls help me, how to return array of object and how to get name and id values in other class using this array object
Thanks for ur help

public class Starting{
public long empID;
Data data = new Data();
Value[] value;
int count = 0;
     public static void executeDe(){
          value = new Value[100]
          try{
                 data.getDetails()
                 processDetails(value);
               }catch(Exception e){e.printStackTrace();}
     public static void processDetails(Value[] value){
     count = data.i;
          int i;
          for(i=0;i<count;i++){
              empID=value.getempID(); \\ here i am not getting all values..... am getting only last value of the array
public class Data{
public long empID;
public int i=0;
static Value[] value = new Value[100];
public static Value[] getDetails(){
Connection con=null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@" + hostname + ":1521:" + sid, user, password);
System.out.println(" conn " + con);
System.out.println("");
Statement s=con.createStatement();
try{
     ResultSet rset = s.executeQuery("select EMPID from Employee ");
     while(rset.next()){
empID = rset.getLong("EMPID");
value[i].setCycleID(cy_i);
i++;
     rset.close();
     con.close();
}catch (SQLException sqle){sqle.printStackTrace();}
     finally{
          try{
          s.close();
     con.close();
          }catch(SQLException e){e.printStackTrace();}
catch(Exception e){e.printStackTrace();}
return value;
     public class Value {
     public static long cycleID;
          public static void setempID(long empID) {
               Value.empID = empID;
          public static long getempID() {
               return empID;
This is my actual code..... I am able to set the values in Value class from Data class using getDetails() method, which is returning array of value object.
In Starting class, I am trying to get values using value[i].. i am getting last value of the array. This is my actual problem... here i want to get all values.
Please help me how to resolve this.

Similar Messages

  • 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

  • How to pass array of Object in A Procedure using OCCI.......

    I m also trying for How to pass Object to a procedureb using OCCI...
    Steps....
    1. I created A type.....
    2. Then I created a VARRAY using that Type.
    3.After that I have written An Procedure with object as a parameter..
    now using OCCI how do u bind the parameter with this . plz note that using OTT
    i have already created the class representation of above object type i.e class
    four Files Created 1> demo.h 2>registermapping.h
    3> demo.cpp 2>registermapping.cpp
    After I want to Pass the Values in A Vector...
    vctor<full_name *> vect;
    stmt=con->createStatement("BEGIN Add_Object(:1); END;");
    full_name *name1 = new full_name; //Giving the Error here Given below....
    name1->
    name1->
    Through name1 Which Function I will call in which I will Pass a String....
    like
    name1->readSQL("Sanjay"); Or I have to add a function......
    vect.push_back(name1);
    setVector(stmt,1,vect,"FULL_NAME");
    error C2259: 'FullName' : cannot instantiate abstract class
    can u plz suggest me Why this Error is Giving......?
    How to pass the data?
    setFirst_name() and setLast_name() this two function I will add in Demo.cpp which one created automativcally by Using OTT command.....or other way plz tell me Boss ....
    Can u lz Suggest me ASAP....

    hi Nishant ,
    What u have done Now I mm trying ....
    can u Plz Suggest me......
    How to pass and Array of Object in Procedure using OCCI... Doing....
    90% finished Two Error's Are Coming...
    1> If I create the Class then Data Not Inserting table......
    2> If I will create the Class through OTT command.......
    then U can't Instantiate Object It is DIsplying ,this is Abstract Class(PObject)...
    Beco'z the below Method is Not adding Automatically by OTT command which is Pure Virtual Function.....
    But I added this Function Still SAme Error Giving..
    getSQLTypeName(oracle::occi::Environment env, void *schName,
    unsigned int &schNameLen, void **typeName,
         unsigned int &typeNameLen) const
    Plz Suggest me....
    regard's
    sanjay

  • How to Sort Array of Object

    Hallo. I have an array of objects. Each object has id and name. How can i sort by name or by id??
    Thx for all
    Max

    array.sortOn("name");

  • JAVA&SOAP:how to return a complex object( the object has an object within)

    Lets say my Complex object is :
    public class PersonWithAddress {
    private String name;
    private int ssn ;
    private Address add;
    PersonWithAddress() {
    name="Gagan Tandon" ;
    ssn =1111;
    add = new Address("1113","WestPlum Street");
    public String getName() {
    return name;
    public int getSSN() {
    return ssn;
    public Address getAddress() {
    return add;
    This complex object has Address object embedded in it.
    public class Address {
    private String house;
    private String street;
    public Address (String myHouse,String myStreet) {
    house = myHouse;
    street = myStreet;
    public String getHouse() {
    return house;
    public String getStreet() {
    return street;
    My deployment Descriptor is as following: check the mappings part.
    <isd:service xmlns:isd=
    "http://xml.apache.org/xml-soap/deployment"
    id="urn:xml-soap-person-demo">
    <isd:provider type="java"
    scope="Application"
    methods="getPersonWithAddress">
    <isd:java class="PersonServer"/>
    </isd:provider>
    <isd:faultListener>
    org.apache.soap.server.DOMFaultListener
    </isd:faultListener>
    <isd:mappings>
    <isd:map
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:x="urn:xml-soap-person-demo" qname="x:PersonWithAddress"
    javaType="PersonWithAddress"
    java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
    xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
    <isd:map
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:x="urn:xml-soap-person-demo" qname="x:Address"
    javaType="Address"
    java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
    xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
    </isd:mappings>
    </isd:service>
    And in my SOAPRPC code at client end calls the following: check the mappingregistry code...
    String serverHost = "http://localhost:8082/soap/servlet/rpcrouter";
    SOAPMappingRegistry smr = new SOAPMappingRegistry();
    Parameter p= null;
    try {
    System.out.println("here 0");
    Response r=null;
    Call c=new Call();
    Vector parameters = new Vector();
    System.out.println("here 1");
    c.setTargetObjectURI ("urn:xml-soap-person-demo");
    c.setMethodName ("getPersonWithAddress");
    System.out.println("here 3");
    c.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
    // parameters.addElement (new Parameter("name", String.class, "Web Services Client", null));
    // c.setParams (parameters);
    c.setSOAPMappingRegistry(smr);
    BeanSerializer beanSer = new BeanSerializer();
    smr.mapTypes(Constants.NS_URI_SOAP_ENC,new QName("urn:xml-soap-person-demo","Address"),Address.class,beanSer,beanSer);
    smr.mapTypes(Constants.NS_URI_SOAP_ENC,new QName("urn:xml-soap-person-demo","PersonWithAddress"),PersonWithAddress.class,beanSer,beanSer);
    try
    System.out.println("here 4");
    r = c.invoke ( new URL(serverHost), "" );
    // org.apache.soap.SOAPException can be thrown
    catch ( Exception e )
    e.printStackTrace();
    // Check the response.
    if (r.generatedFault ()) {
    Fault f = r.getFault();
    System.out.println ("Error Occurred: ");
    System.out.println (" Fault Code = " + f.getFaultCode());
    System.out.println (" Fault String = " + f.getFaultString());
    // return f.getFaultString();
    // return new String("gagan");
    return null;
    else {
    System.out.println("here 5");
    p = r.getReturnValue();
    System.out.println("here 6");
    // System.out.println( (String)greeting.getValue() );
    System.out.println("SSN: " + ((PersonWithAddress)p.getValue()).getSSN());
    return (PersonWithAddress) p.getValue();
    catch( Exception e ){
    e.printStackTrace();
    // finally {
    // return null;// String("not OK");
    if (p==null)
    return null;
    else
    return (PersonWithAddress) p.getValue();
    When running this code..
    The following error is thrown.
    System.out.println("here 4") is printed.
    [SOAPException: faultCode=SOAP-ENV:Client; msg=Unable to instantiate 'PersonWithAddress': Class org.apache.soap.encoding.soapenc.BeanSerializer can not access a member of class PersonWithAddress with modifiers ""; targetException=java.lang.IllegalArgumentException: Unable to instantiate 'PersonWithAddress': Class org.apache.soap.encoding.soapenc.BeanSerializer can not access a member of class PersonWithAddress with modifiers ""]
    at org.apache.soap.rpc.Call.invoke(Call.java:294)
    at PersonClient.getPersonWithAddress(PersonClient.java:92)
    at PersonClient.<init>(PersonClient.java:11)
    at PersonClient.main(PersonClient.java:20)
    java.lang.NullPointerException
    at PersonClient.getPersonWithAddress(PersonClient.java:96)
    at PersonClient.<init>(PersonClient.java:11)
    at PersonClient.main(PersonClient.java:20)
    I am here 1
    Exception in thread "main" java.lang.NullPointerException
    at PersonClient.<init>(PersonClient.java:13)
    at PersonClient.main(PersonClient.java:20)
    What could be the problem..? Is there any info on net how could i pass complex objects of this type in Java through SOAP RPC.
    GAGAN

    Have you managed to sole the problem ? I have got similar one...
    [SOAPException: faultCode=SOAP-ENV:Client; msg=Unable to instantiate 'auction.common.Property': auction/common/Property]
         at proxy.soap.AuctionHistoryProxy.addAuctionProperty(AuctionHistoryProxy.java:515)
         at java.lang.reflect.Method.invoke(Native Method)
    (...)

  • How to return array of String to a java program.! ??

    Hi All,
    I am new to JNI programming. so trying with simple example. I am having one problem. I have one array of String in my Java program. I want to reverse all the elements in this array and want back this new array in the same form i.e. array of string. So how can I do this ??
    Please guide me.....
    The function of defination of array in my java code is
    public native String[] getReverseStringArray(String[] arrString);
    where as my array is like:
    String[] arrStr = {"one", "two", "three", "four", "��������","�c��","�J�^�J�i"};
    and I am calling function in C file like:
    arrStr = employee.getReverseStringArray(arrStr);
    and the function defination in my c file is
    JNIEXPORT jobjectArray JNICALL
    Java_Emp_getReverseStringArray (JNIEnv *env, jobject obj, jobjectArray arr)
    // some code will come here......
    So can anybody tell me how to do this ??
    Thanx in advance...
    Pandurang
    [email protected]

    Hi,
    this is quite simple. Here an example function that works like this:
    JNIEXPORT jobjectArray JNICALL Java_cadagent_ugopen_UgAssembly_jni_1getStructure
    (JNIEnv *env, jclass cls, jstring part)
    jobjectArray retvals = NULL;
    jstring j_val = NULL;
    int child_count = 5;
    /* initialize return array */
    j_val = (*env)->NewStringUTF(env, "");
    retvals = (*env)->NewObjectArray(env, child_count, (*env)->FindClass(env, "java/lang/String"), j_val);
    for (i=0;i<child_count;i++)
    j_val = (*env)->NewStringUTF(env, "some text");
    (*env)->SetObjectArrayElement(env, retvals,i, j_val);
    return retvals;
    Hope this answers you question.

  • Not sure on how to return a new object

    hi i am not sure on how to return a new Set object, i am not asking how to code this, i just don't exactly know what to write after "return.." to return a new object ...that part of the code is towards the bottom where i put arrows.....this is the skeleton of the code:
    public class Set
         // define fields here
         public Set(int maxinteger)
              // complete this method
         public boolean add(int integer)
              return false; // replace this line with your code
         public boolean remove(int integer)
              return false; // replace this line with your code
         public boolean contains(int integer)
              return false; // replace this line with your code
         public int size()
              return 0; // replace this line with your code
         public String toString()
              return null; // replace this line with your code
         public void addAll(Set other)
              // complete this method
    --------->     public Set subset(int min, int max)
              return null; // replace this line with your code
    ----------->     public Set intersection(Set other)
              return null; // replace this line with your code
    ------------->     public Set difference(Set other)
              return null; // replace this line with your code
         }

    well, when you use return is when trying to make a method have a value that have to be returned from it.
    In your case you have a Set CLASS, with methods, some methods have to return Strings, ints, Objects, etc.
    just make sure that you are returning the same type of value than the method say.
    the method parts are:
    modifier returnType name (parameters) {
    . code
    modifiers are public, private, etc.
    the return type specifies what the method will return, for example:
    public String toString () {
    must return a String value.
    to return a new Object just do it like a simple value, Strings are objects.
    just define a Set object and then return it.

  • How to return new blob object?

    Hi,
    I am trying to find documentation on how to return a custom abstract data type (ADT) using the CREATE TYPE... and BLOB interface.
    How can I return a new object type defined inside a blob. Can I return a blob (without initializing the lob locator first)?
    Please advise.

    Hi,
    Please check the below link.
    http://docs.oracle.com/cd/E24693_01/appdev.11203/e17126/create_type.htm
    Regards,
    Sailaja

  • How to return array of unsigned integer pointer from call library function node & store the data in array in labview

    I want to return array of unsigned integer from call library node.
    If anybody knows please help me
    Thanks & Regards,
    Harish. G.

    Did you take a look at the example that ships with LabVIEW that shows how to do all sorts of data passing to DLLs. I believe your situation is one of the examples listed. You can find the example VI in the "<LabVIEW install directory>\examples\dll\data passing" directory.

  • How to implement array of objects or vector of objects?

    Hello, i am working on a javabean that is connecting to a database and executes an sql string. The javabean returns the records retrieved in a tabular format.
    Currently i can achieve the above requireement, but only through using a simple table-formatted string, this is not dynamic and a 2d array approach would not be dynamic either.
    I have read a little about using a dynamic approach, possiblya vector of objects, or array list of objects to solve the problem, but i don't really know how to start, could anybody help me??
    The code i have so far is:
    package webtech;
    import java.sql.*;
    public class questiona {
    /* Step 1) Initialize Variables*/
    String result = "";
    String query = "select id, name, url, thumb_url, keywords, category, author from mytable;";
    String url = "";
    String driver = "";
    String uname = "";
    String dpass = "";
    /*Step 2) Make a database connection*/
    private Connection dbconn = null;
    public questiona()
    try
    Class.forName(driver);
    dbconn = DriverManager.getConnection(url, uname, dpass);
    /*Create an SQL statement*/
    Statement statement = dbconn.createStatement();
    if (statement.execute(query))
    {/*Step 3) If we have a result lets loop through*/
    ResultSet results = statement.getResultSet();
    ResultSetMetaData metadata = results.getMetaData();
    /*Validate result. Note switch to while loop if we plan on multiple results from query*/
    if(results != null)
    /*Use results setmetadata object to determine the columns*/
    int li_columns = metadata.getColumnCount();
    result += " <tr>\n\r";
    result += " <td>" + metadata.getColumnLabel(1) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(2) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(3) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(4) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(5) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(6) + "</td>\n\r";
    result += " <td>" + metadata.getColumnLabel(7) + "</td>\n\r";
    result += " </tr>\n\r";
    /*loop throught the columns and append data to our table*/
    while(results.next())
    result += " <tr>\n\r";
    result += " <td>" + results.getObject(1).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(2).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(3).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(4).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(5).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(6).toString() +"</td>\n\r";
    result += " <td>" + results.getObject(7).toString() +"</td>\n\r";
    result += " </tr>\n\r";
    catch (ClassNotFoundException e)
    {     result = "<tr><td> Error in database";
    result += " <br/>" + e.toString() + "</td></tr>";
    catch (SQLException e)
    {     result = "<tr><td> Error in SQL";
    result += " <br/>" + e.toString() + "</td></tr>";
    finally
    try {
    if (dbconn !=null)
    { dbconn.close();}
    catch (SQLException e)
    {   result  = " <tr><td> Error in closing connection.";
    result += " <br/>" + e.toString() + "</td></tr>";
    public String getResults() {
    return result;
    }

    Cross-post
    http://forum.java.sun.com/thread.jspa?threadID=604770

  • How to do Array of objects

    Hi,
    I was wondering if XMP is capable of holding an array of multiple objects. We have historical data that is represented with multiple fields. The normal schema would look like:
      <rdf:Description rdf:about="" xmlns:nef="http://ns.phics.com/nefclient/1.0/">
             <nef:Division>BTF</nef:Division>
             <nef:Season>0914</nef:Season>
             <nef:Sku>91346</nef:Sku>
             <nef:Usage>Print</nef:Usage>
             <nef:Status>Approved</nef:Status>
          </rdf:Description>
    How can I add this addionional data some?
              <nef:History>
                   <nef:issue>blah01</nef:issue>
                   <nef:date>12-12-12</nef:date>
                   <nef:color>red</nef:color>
                   <nef:issue>blah02</nef:issue>
                   <nef:date>1-12-10</nef:date>
                   <nef:color>blue</nef:color>
                   <nef:issue>blah03</nef:issue>
                   <nef:date>02-12-08</nef:date>
                   <nef:color>red</nef:color>
                   <nef:issue>blah04</nef:issue>
                   <nef:date>11-09-06</nef:date>
                   <nef:color>white</nef:color>   
               </nef:History>
    Thank you for your time
    Dean Krueger

    Hi Dean,
    what you want to do is perfectly supported in XMP. The History property would be an array (ordered or unordered, as you like) and each array element is a struct with three fields.
    It would look like this:
    <nef:History>
         <rdf:Bag>
              <rdf:li  rdf:parseType="Resource">
                   <nef:issue>issue</nef:issue>
                   <nef:date>date</nef:date>
                   <nef:color>color</nef:color>
              </rdf:li>
              ...etc
         </rdf:Bag>
    </nef:History>
    If you are using the XMP toolkit in your program, you can refer to the Programmer's Guide for reference how to create such an array.
    regards
    Jörg

  • EJB : How to return user defined object

    hi,
    i am a newbie in EJB. i have the following simple problem:
    public interface MyApp extends EJBObject
       public String getResult() throws RemoteException;
    }the above code will be ok because it is returning String object.
    however, i need to return a user defined object like:
    public interface MyApp extends EJBObject
       public MyResult getResult() throws RemoteException;
    }then i got java.lang.ClassCastException during runtime.
    please tell me how to resolve this problem.
    thank you very much

    since you are a newbie, let me explain something to you. Ask your question in the proper forum. In case, you still don't understand there is a forum for EJB questions.

  • How to manage Arrays as Object members

    I found a realy strange behavior with the instanciation of a
    Class which contains an Array member.
    Here is the code wich is self explanatory.

    Create the array instance in the constructor.
    class MyObj {
    public var tab:Array;
    function MyObj(index) {
    this.tab= new Array();
    "Chris_007" <[email protected]> wrote in
    message
    news:[email protected]...
    > I found a realy strange behavior with the instanciation
    of a Class which
    > contains an Array member.
    >
    > Here is the code wich is self explanatory.
    >
    >
    >
    >
    >
    > class MyObj {
    > //
    > public var tab:Array = new Array();
    > private var objectName:String;
    > private var theIndex:Number;
    > //
    > // Constructeur
    > function MyObj(index) {
    > this.theIndex = index;
    > // Object name
    > this.objectName = "name#" + index;
    > for (var i = 0; i < 3; i++) {
    > this.tab
    = index * 3 + i;
    > }
    > }
    > //
    > function printObject() {
    > trace(" Printing Object name --> " +
    this.objectName);
    > for (var i = 0; i < 3; i++) {
    > trace(" tab[" + i + "] : " + this.tab);
    > }
    > }
    > //
    > function getClone() {
    > return new MyObj(theIndex);
    > }
    > }
    >
    >
    > // And the main scenario code
    > //
    > var index:Number = 0;
    > //
    > var objArray:Array = new Array();
    > //
    > var oob:MyObj;
    > //
    > function printMyArray(arr:Array):Void {
    > for (var i = 0; i < arr.length; i++) {
    > trace(" tab[" + i + "] : " + arr
    > }
    > }
    > //
    > // Filling in the Array
    > for (var i = 0; i < 4; i++) {
    > oob = new MyObj(index);
    > // oobj = oob.getClone();
    > trace("-- New object #" + i + " created. MyObj[" + index
    + "]");
    > oob.printObject();
    > objArray = oob;
    > trace("-- Now entered into the array -- printing from
    object #" + i );
    > objArray
    .printObject();
    > trace("-- or printing from the scenario -- objArray[" +
    i + "] is realy
    > stored");
    > printMyArray(objArray.tab);
    > trace("____________________________________");
    > index += 1;
    > }
    > //
    > // Printing the array of pointers to MyObj
    > trace("___________________________________________");
    > trace("And now, all in one...\nPrinting the array of
    pointers to MyObj
    > trace("___________________________________________");
    > for (var i = 0; i < 4; i++) {
    > objArray
    .printObject();
    > }
    > trace("------ Or directly from the scenario -------");
    > for (var i = 0; i < 4; i++) {
    > trace(" Printing from scenario Object name --> " +
    objArray.objectName);
    > printMyArray(objArray
    .tab);
    > }
    > trace("___________________________________________");
    > trace("They are all the same ?!\nIt seems to have lost
    something !!!!");
    > trace("___________________________________________");
    > //
    > //
    > trace("\nAmazingly, the array's elements do not refer to
    the same
    object\n");
    > //
    > trace("objArray[0] == objArray[0] ? -->" +
    (objArray[0] == objArray[0]));
    > trace("objArray[0] == objArray[1] ? -->" +
    (objArray[0] == objArray[1]));
    > trace("objArray[0] instanceof MyObj ? -->" +
    (objArray[0] instanceof
    MyObj));
    > trace("");
    > //
    > trace("\nThey realy seem to point different objects
    !\n");
    > //
    > // So, why do they have different outputs ?
    > //
    > //
    > //
    > // It seems the 'new' constructor creates a new Object
    'MyObj'
    > // which always resides at the same memory location.
    > // 'oob' is in fact a pointer, and objArray[] an array
    of pointers,
    > // as so an array of memory addresses.
    > // The objArray[] elements are pointers which always
    refer to the
    > // the same memory zone, which in fact contains the last
    content of the
    > object.
    > //
    > //
    > // And then manualy
    > //
    >
    trace("**********************************************************");
    > trace("\nAnd then another way to create each new object
    manualy\n");
    >
    trace("**********************************************************");
    > //
    > //
    > var otherObjArray:Array = new Array();
    > //
    > var oob0 = new MyObj(100);
    > trace("-- New object created #100");
    > oob0.printObject();
    > otherObjArray[0] = oob0;
    > trace("-- Now entered into the array --
    otherObjArray[0]");
    > otherObjArray[0].printObject();
    > //
    > var oob1 = new MyObj(200);
    > trace("-- New object created #200");
    > oob1.printObject();
    > otherObjArray[1] = oob1;
    > trace("-- Now entered into the array --
    otherObjArray[1]");
    > otherObjArray[1].printObject();
    > //
    > var oob2 = new MyObj(300);
    > trace("-- New object created #300");
    > oob2.printObject();
    > otherObjArray[2] = oob2;
    > trace("-- Now entered into the array --
    otherObjArray[2]");
    > otherObjArray[2].printObject();
    > //
    > trace("___________________________________________");
    > trace("And now, all in one...\nEnjoy the show !!!!");
    > trace("___________________________________________");
    > otherObjArray[0].printObject();
    > otherObjArray[1].printObject();
    > otherObjArray[2].printObject();
    > //
    > trace("\nThe problem seems to reside in the way the
    Arrays members are
    managed
    > by the Objects !\n");
    > trace("\nHELP me please to find the bug\n");
    > //
    >

  • How to return a java object to VB through the activex bridge?

    Hello,
    I am trying to return more than just a primitive data type to VB from Java. To do this, I compile the two attached files and jar them into FastStatWrapper.jar which I then run through packager.exe and thus end up with an activex object. I then instantiate the FastStatWrapper object in VB and call execute in the following way:
    dim result as Object
    Dim wrapper as Object
    Set wrapper = CreateObject("FastStatWrapper.Bean.1")
    Set result = wrapper.execute("SOMETHING")However, I can't seem to access the result object. It doesn't have any methods. Do I have to package it as a separate bean?
    package test;
    public class FastStatWrapper
         public FastStatWrapper()
         public StatData execute(String _command)
              return new StatData("A", 3.0);
    }and here the data object...
    package test;
    public class StatData
         private String name = null;
         private double value;
         public StatData(String _name, double _value)
              name = _name;
              value = _value;
         public String getValueType()
              return name;
         public double getValue()
              return value;
    }                    

    The returned java object will be exposed as a dispatch object. You should be able to call methods on the returned java object. However, type information will not be available for that object and hence no support for code completion and syntax checking.

  • How to return custJava Object from Java Stored Function/Procedure to Java Application

    I WILL PAY $100 FOR SOLUTION.
    Oracle JDBC documentation gives step by step on how to return Oracle Type Object to Java Application. No question here.
    But is it possible to create Java Stored Function [getMyClass() ] which returns CUSTOM Java based object [MyClass] to Java application like:
    //java stored function
    class Foo
    public static MyClass getMyClass()
    return new MyClass();
    //java class I want to return to Java
    class MyClass
    public String getGreetings(String name)
    return "Hello " + name;
    I tried to do it using intermittent Oracle
    Type Object and OracleConnection map to make binding between Java->Oracle->Java. I could
    not get throgh meaningless run time ORA Errors. Any kind of help would be greatly
    appreciated. If you know the answer please
    post it or e-mail [email protected]
    null

    You don't say which version of the database you are on. There's an interesting looking article on OTN on handling CLOBs in JDBC in 10g. It may well be useful for earlier versions too (but no guarantees).
    Cheers, APC

Maybe you are looking for

  • Monitor EDID has died and I need assistance

    Okay. Recently the EDID function of my monitor has stopped, but because Windows keeps a local version of my EDID, I have the .bin file with the info needed, and I need to point X to it, but I can't find anything on Google that sheds any light on the

  • How do I select and move all elements on the stage?

    I know this is probably easy to someone but I have spent too much time on it so I give up. Can someone tell me how to select all the elements in every frame on the stage and simply move it up? Appreciate any feedback!

  • Issue For Invoice Blocked For Payment

    Dear All, We received Stock Using MIGO and stock moves in Quality Check. After Invoice Posted using MIRO Invoice created and displayed messages as blocked for payment. Now While making payment for that particular Invoice, system is allowing me to pos

  • [nQSError: 59001] Binary Logical operation is not permitted

    Hi All, I am querying 3 columns in a report. E.g. Sales -> Directly pulled from the database column Prior Month Sales -> AGO("Sales subject area"."Key Measures"."sales", "Sales subject area".Time_Dimension."Month", 1) Current YTD -> (CASE WHEN "Sales

  • Need help with openDialog

    In the Photoshop script I'm writing, I ask the user to open a file using:      open(File(openDialog())); That works fine. But the user will always be opening an Illustrator (.ai) file. Normally that brings up a dialog box called "Import PDF". But tha