Java Object Creation

A general question about how can Java object creation with an average amount of data retrieval is considered as a reasonable.
For example if I am clicking on a link in a web application...to paint that page, I think, about 4-5 java object with an average data retrieval of 20 rows wud be considered as appropriate. Any other thoghts or any other parameters to take into consideration?

If you are concerned about object creation speed, you probably shouldn't. Even my laptop PC can create and garbage collect some 12 million objects per second (10,000,000 objects takes about 800 milliseconds). Test program below; remember to run with "java -server" to get the faster optimizing compiler. For laughs, write an equivalent C++ program that does new&delete in a similar loop.
public class CreateObject
    public static void main(String args[])
     throws Exception
     for (int m = 0; m < 5; m++)
         doit();
    static void doit()
     long start = System.currentTimeMillis();
     for (int n = 0; n < 10 * 1000 * 1000; n++) {
         new CreateObject();
         new CreateObject();
         new CreateObject();
         new CreateObject();
         new CreateObject();
         new CreateObject();
         new CreateObject();
         new CreateObject();
         new CreateObject();
         new CreateObject();
     long end = System.currentTimeMillis();
     System.out.println((end - start) + " ms");
}

Similar Messages

  • Object creation of string

    Hello
    Please tell me what is the difference between these two object creation of string.
    String str = new String("Hello");.
    String str="Hello";
    Thanks.

    RGEO wrote:
    hello,
    Is the string pool is part of a heap? Huh? I suppose yes, you could regard the String pool as part of the heap... but (I guess) that interned String objects would be placed directly into the permanent generation, which is not garbage collected... and therefore I don't really think of the permanent generation as part of the heap (except when tuning heap allocations)... but I think I'm talking over your noob head here, yes... and so to the noob-stuff.
    If you get bored you might like to scan (for now) http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html#generations ... and come back to it in a couple of years time (when every second word isn't new and baffling to you;-)
    jvm what will do when he encounter the following code,
    String s1 = new String ("hello");The VM will:
    1. Create a new String object, and then
    2. copy the characters 'h','e','l','l','o' from the interned String "hello" to the new String,
    3. and then assign a reference to the new String to variable s1.
    Note that the result is subtley different from String s1 = "hello", which just does step 3... it assigns a reference to the existing interned String object "hello" to the variable s1... it does not create and "populate" a new String object.
    Try this just for fun... what is the output of the following program? Why?
    package forums;
    public class StringEquals
      public static void main(String[] args) {
        try {
          String a = "Hello";
          String b = "Hello";
          System.out.println("a==b is "+(a==b));
          String c = new String("Hello");
          System.out.println("a==c is "+(a==c));
        } catch (Exception e) {
          e.printStackTrace();
    }Now, what's the correct way to evaluate equality of String objects in Java?
    HTH. Cheers. Keith.

  • While Loop - Object Creation

    Hello,
    I have a question on object creation and while loops. Have a look at the following code snippet:
    while(true)
           Object obj = new Object();
           // Pass off obj to a new thread
           Thread job = new Thread(new ObjectHandler(obj));
           job.start();
    }My question is, do I have to wait until the newly created Thread is finished with the Object obj before I can create a new Object called obj in the while loop?
    Also does anyone have any documentation on this sort of thing?
    Thanks,
    Tony.

    Jaxie wrote:
    I'm still not sure you get what I'm on about, you might want to read up on java methods and pass by value.I think we know how it works. Most of us have been programming in Java for serveral years.
    >
    When you pass an object to a method in java you pass it a copy of a reference to that object. Leading on from that, before an object is eligible for garbage collection in java, all references to that object must be dropped.
    So with all that in place, my question was, is the creation of an object in a while loop dependent on previous objects of the same name? Objects don't have names. Have we mentioned that before?
    You have a reference, larry that is referencing an unnamed object. You can also create other references that reference the same object. The thread will have one reference. You can then make larry reference another object. That will not change anything in the thread. It will still reference the old object, and that object will not be claimed by the gc until that thread stops referencing it.
    So the second time we go through the loop below, do we have to wait until larry has been garbage collected, before a new larry can be created?Read the articles/tutorials and what I have written above. What do you think?
    Do also note that the GC isn't executed synchronously.

  • Use String Variable in New Object Creation

    Thanks to those who review and respond. I am new to Java, so please be patient with my terminoloy mistakes and fumblings. I am reading in a file and I want to create a new object based on specific field (car for example). As you will notice I grab field 8 here label sIID.
    String sIID = dts.group(8);
    BTW this regex grouping works fine. The problem is seen when I try to use the sIID variable in my new object creation process.
    DateParse sIID = new DateParse();
    My IDE is reporting "Variable sIID is already defined in the scope"
    Is this possible? The assumption is that the sIID will have different value during the processing of the file. For example, car could mean truck, sedan, etc with operators like color, number of doors, mileage, top speed, etc.

    Thanks for the reply. I have include similar and much shorter code for the sake of brevity.
    My problems are centered around the x variable/object below. Ideally this would translate to three objects PersonA, PersonB, etc that I could reference later in the code as PersonA.newname if I wanted to. Hopefully this makes sense.
    public class TestingObjects {
      public static void main(String[] argv) {
           String [] names;
           names = new String[3];
           names[0] = "PersonA";
           names[1] = "PersonB";
           names[2] = "PersonC";
           for (String x:names) {
             PN x = new PN();  // <- Problem
             x.name = x;
             x.SayName();
            System.out.println(x.newname);
    public class PN {
           String name;
           String newname;
      public String SayName() {
           newname = "Name = " + name;
           System.out.println(name);
          return newname;
    }

  • How to transform Java object to XMLTYPE ?

    hi,
    I have a Java object (POJO), that I would like to store to oracle xdb (XMLTYPE table). Is there a way to have something like XmlType.createXML(connection, POJO) or XmlType.createXML(connection, POJO, schema) ?
    Currently I transform it as -->
    POJO -> DOM-> String -> InputStream -> XMLTYPE.create( connection, Istream )
    or
    POJO -> DOM-> -> XMLTYPE.create( connection, DOM ) -- which is too slow as xml text size increases above 15kb
    2. My JDBC connection is slow. If theres a way to avoid it in XMLType creation, thts even better.
    3. Pls suggest other ways of doing this.
    Thanks in advance.

    you may try some XML binding tool instead of DOM. (e.g. http://xstream.codehaus.org/tutorial.html).
    There is no problem generating DOM. Its about generating oracle.xdb.XMLType using java api. Could you show a code snippet that would generate XMLType using xstream or other XML binding tools ?
    2) you may use DBMS_XDB.CREATERESOURCE to create a resource from varchar2 or clob parameter.
    Could you show a code snippet that inserts into Secure Binary XMLType table using CreateResource ? Im not using schema. Also Varchar supports 32kb. Conversion from Java String XML to CLOB is expensive ( because Oracle uses jdbc connection)

  • JVM 1.5.0, parallelism and object creation

    Hi.
    I am currently running Java 1.5.0 on a production server. This server is a 4-cpu 2gb ram beast running Red Hat ES 3. It provides MySQL backend and a Java server to be accessed through a Flash client.
    So far, the Flash client fares well. MySQL takes worst cast 16% of one CPU for very heavy selections. But I am having problems with optimizing the Java part that does everything.
    First and foremost, I cannot change the way it is. Our java code is mostly vendor code, thus we can't really expect to be able to easily change the code. Whatever code we added to the vendor code is definitely not the bottleneck, it's optimized, it's properly synchronized and it's very effective.
    I would like to give you an idea of how things fares. You will see my problem soon.
    - I am running one process of Java. This process is -Xms and Xmx'ed to 384 megs.
    - The total DSize of the Java environment is more than a gigabyte due to the 1000+ threads that runs through it. More so, every client that runs through it adds up at least two threads.
    - There are massive object creation and destruction happening. For a 100-client system, the "eden" memory is filled up and GC'ed at least twice per second. Since 1.5.0, the "old" memory of 384m gets filled up in 10 minutes, and GC'ed at that point.
    - CPU usage is having fun between 80% and 150% of one CPU (remember I have 4 CPUs so 150% is 150/400% total usage)
    - GC is the major speed bump for my server, as if I put 768 megs of Xmm instead of 384, cpu usage drops to 60%-90% CPU, that is, until memory gets filled up and swap gets used (do the math: 768m + 1200 thread stacks)
    Now it works fine. 100 users, it's perfect. My major problem is that from next week on, we are planning 300+ users. Ouch.
    So my few questions are:
    - In knowing that garbage must constantly be collected, is there something I can do in the environment to make it happen all the time in background? Or am I bound to have all 4 cpu's stopped momentarily twice per second so that it might happen?
    - In 1.4.x, I could change "eden" memory block size. It doesn't seem to be the same for 1.5.x. What's up with that? I used to increase it dramatically, making GC longer but less frequent, increasing parallelism force.
    I am asking the questions because I am not in position of trying "what if"s with my production server. The test server handles well our 8 internal users ... but we are not close of making the same amount of request as our 100-users production server... so we cannot reliably try out options. Best case is see if it crashes or now.
    Thanks
    Mike

    Mikle -- please make sure that you are using either the
    UseParallelGC collector or the UseConcMarkSweepCollector.
    Both would appear to address some of the problems you
    mention.
    You may need to tune the size of the young generation
    explicitly. Check out the GC tuning documents/tips
    at:
    http://java.sun.com/docs/hotspot
    You should make sure your application is not paging.
    Since the default thread stack sizes are large (2 MB?)
    and you may not need that much, you can try -Xss256k
    (for example) to reduce the virtual memory requirements
    for your thread stacks and free up more address space
    for the Java heap.
    In the end, for an application of the kind you describe you
    probably need to go 64-bit and use a larger Java heap
    along with the parallel/concurrent collector to deal with the
    attendant GC overheads. That (going 64-bit) should be easy
    (trivial) if your application is pure Java.
    Hi.
    I am currently running Java 1.5.0 on a production
    server. This server is a 4-cpu 2gb ram beast running
    Red Hat ES 3. It provides MySQL backend and a Java
    server to be accessed through a Flash client.
    So far, the Flash client fares well. MySQL takes worst
    cast 16% of one CPU for very heavy selections. But I
    am having problems with optimizing the Java part that
    does everything.
    First and foremost, I cannot change the way it is. Our
    java code is mostly vendor code, thus we can't really
    expect to be able to easily change the code. Whatever
    code we added to the vendor code is definitely not the
    bottleneck, it's optimized, it's properly synchronized
    and it's very effective.
    I would like to give you an idea of how things fares.
    You will see my problem soon.
    - I am running one process of Java. This process is
    -Xms and Xmx'ed to 384 megs.
    - The total DSize of the Java environment is more than
    a gigabyte due to the 1000+ threads that runs through
    it. More so, every client that runs through it adds up
    at least two threads.
    - There are massive object creation and destruction
    happening. For a 100-client system, the "eden" memory
    is filled up and GC'ed at least twice per second.
    Since 1.5.0, the "old" memory of 384m gets filled up
    in 10 minutes, and GC'ed at that point.
    - CPU usage is having fun between 80% and 150% of one
    CPU (remember I have 4 CPUs so 150% is 150/400% total
    usage)
    - GC is the major speed bump for my server, as if I
    put 768 megs of Xmm instead of 384, cpu usage drops to
    60%-90% CPU, that is, until memory gets filled up and
    swap gets used (do the math: 768m + 1200 thread
    stacks)
    Now it works fine. 100 users, it's perfect. My major
    problem is that from next week on, we are planning
    300+ users. Ouch.
    So my few questions are:
    - In knowing that garbage must constantly be
    collected, is there something I can do in the
    environment to make it happen all the time in
    background? Or am I bound to have all 4 cpu's stopped
    momentarily twice per second so that it might happen?
    - In 1.4.x, I could change "eden" memory block size.
    It doesn't seem to be the same for 1.5.x. What's up
    with that? I used to increase it dramatically, making
    GC longer but less frequent, increasing parallelism
    force.
    I am asking the questions because I am not in position
    of trying "what if"s with my production server. The
    test server handles well our 8 internal users ... but
    we are not close of making the same amount of request
    as our 100-users production server... so we cannot
    reliably try out options. Best case is see if it
    crashes or now.
    Thanks
    Mike

  • Is it possible to restrict the object creation for stateless session beans

    Hi,
    Is it possible to restrict/fix the ejb object creation for stateless session beans in application server?
    For example, i want to configure the application server ( am using JBOSS ) to create maximum of 10 session bean objects. and if any requests for the stateless session bean come, as application server has created 10 objects, the requests should be blocked.
    Thanks in advance,
    nvseenu

    You can keep a counter in the application code. A static var won't work, but an entity and a consistent id should. This version would affect performance, but it would be portable to other app servers.
    // ConstrainedBean.java
    package unq.ejb;
    import javax.ejb.Stateless;
    import javax.ejb.CreateException;
    import javax.annotation.PostConstruct;
    import javax.annotation.PreDestroy;
    import javax.persistence.PersistenceContext;
    import javax.persistence.EntityManager;
    @Stateless
    public class ConstrainedBean implements Constrained {
        final static int DEFAULT_COUNTERID = 1;
        @PersistenceContext EntityManager em;
        @PostConstruct
        protected void init() throws CreateException {
         ConstrainedBeanCounter counter =
             em.find(ConstrainedBeanCounter.class, DEFAULT_COUNTERID);
         if( counter == null ) {
             counter = new ConstrainedBeanCounter();
             counter.counterId = 1;
             counter.counterValue = 0;
             em.persist(counter);
         if( counter.atMaximum() ) {
             throw new CreateException("error attempting to create > 10 beans");
         else {
             counter.increment();
        @PreDestroy
        protected void destroy() {
         ConstrainedBeanCounter counter = em.find(ConstrainedBeanCounter.class,
                                   DEFAULT_COUNTERID);
         counter.decrement();
        public void doSomething() { System.out.println("doSomething()"); }
    // ConstrainedBeanCounter.java
    package unq.ejb;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    @Entity
    public class ConstrainedBeanCounter implements java.io.Serializable
        @Id public int counterId;
        public int counterValue = 0;
        public void increment() {
         counterValue++;
        public void decrement() {
         counterValue--;
        public boolean atMaximum() {
         return counterValue > 9;
    }

  • Is it possible to create the memory for a Java object in C/C++?

    Is it possible to have a C/C++ program allocate some memory, then have JNI use that memory for primitive java objects (such an array of bytes) that are passed to Java objects ?
    I would like to allocate a region of memory in C++, then give that memory to a Java object (via some kind of JNI type) and have that Java object fill the memory region with data.
    My impression from reading the JNI API and the few examples I've looked at is "No", there is a strict boundary between C++ and JNI as regards memory management. There may be serious implications as to why what I'm suggesting is not feasible, I am not enough of a JNI expert to know yet, and would greatly appreciate any input/comment.
    Many thanks,
    Colm.

    No, you cannot. However, writing your JNI code you should not use memory of Local Heap (if it possible). Because Local Heap Memory used also by JVM. I have developed tools that generate C++ wrappers for JNI code. In these wrappers I use mainly Global/Virtual Memory. I also reduce to minimum creation of local/global references, as it is affects to JVM memory use. If you are writing JNI code under MS Windows then you can try my tools that automate JNI code writing:
    http://simtel.net/product.php[id]93174[SiteID]simtel.net
    http://simtel.net/product.php[id]94368[SiteID]simtel.net
    Now I am developing this tool for .Net. In two weeks it will be finished.

  • Share Java Object Instance between JSP's

    Hi@all!
    Can i share a Java Object Instance between JSPages?
    Example:
    Class x
    Public Attribute txt
    Object creation in x.jsp
    set public Attribute txt to "HelloWorld"
    goto y.jsp
    get value from txt
    or...
    a global package
    thnx for help

    Here is a tutorial that explains how to use jsps and javabeans together.
    http://www.roseindia.net/jsp/usingbeansinjsp.shtml
    Quick question is sounds like you are pretty early in your development phase. Have you considered adopting JSF. You may find it a bit easier.
    Regards.

  • Frequent Object Creation vs. synchronized

    HI all,
    I'm just looking to prompt a discussion I can learn from. Apologies if I'm missing something.
    Having just read the excellent articles over at:
    http://www-106.ibm.com/developerworks/java/library/j-threads1.html
    http://www-106.ibm.com/developerworks/java/library/j-threads2.html
    http://www-106.ibm.com/developerworks/java/library/j-threads3.html
    I was left wondering about the (largely unmentioned) trade-off between object creation and use of synchronization.
    If a particular part of a given system is heavily accessed then one might consider instantiating, and caching references to, components in an initialisation stage. In a multithreaded environment, this can obviously pose a problem.
    If these components aren't threadsafe then at some point use will have to be made of a synchronized block, unless the unsafe components are instantiated for every thread.
    The articles do mention the overrated cost of synchronization - how does this compare with the cost of frequent object instantiation?
    Thanks for your time,
    JohnG

    Well, let's time it (test program below):
    using no synchronization: 180 ms (baseline measurement, not thread safe)
    using new: 1111 ms
    using uncontended sync: 491 ms
    using contended sync: 49531 ms
    new is fast - ten million temporary object allocations and frees per second. A magnitude faster than in traditional malloc()/free() -based languages. new is rarely a performance problem in Java programs.
    Uncontended locks are fast - twenty million per second.
    Heavily contended locks slow you down. Way down. A second becomes a minute.
    Don't try to optimize unless you have measured a real performance bottleneck.
    Object pooling is unlikely to help. Exceptions being objects that are expensive to initialize and are created often (e.g. large buffers or arrays, cryptographic engines that take time to initialize, or connections to external systems such as databases). You'll need to measure first if object creation really is the bottleneck.
    public class t
        static class Calculator
         private int value;
         void initialize(int n)
             value = n;
         int result()
             return value * 2;
        static class NewThread
         extends Thread
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              Calculator x = new Calculator();
              x.initialize(n);
              result += x.result();
        static class SyncThread
         extends Thread
         static Calculator x = new Calculator();
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              synchronized (x) {
                  x.initialize(n);
                  result += x.result();
        // Not thread safe
        static class BaselineThread
         extends Thread
         static Calculator x = new Calculator();
         int result;
         public void run()
             for (int n = 0; n < 1000 * 1000; n++) {
              x.initialize(n);
              result += x.result();
        public static void main(String args[])
         throws Exception
         int thread_count = 10;
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++) {
              // threads run consecutively, not in parallel
              (threads[m] = new BaselineThread()).start();
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using no synchronization: " +
                          (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++)
              (threads[m] = new NewThread()).start();
             for (int m = 0; m < thread_count; m++)
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using new: " + (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++) {
              // threads run consecutively, not in parallel
              (threads[m] = new SyncThread()).start();
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using uncontended sync: " +
                          (end - start) + " ms");
         for (int n = 0; n < 5; n++) {
             Thread threads[] = new Thread[thread_count];
             long start = System.currentTimeMillis();
             for (int m = 0; m < thread_count; m++)
              (threads[m] = new SyncThread()).start();
             for (int m = 0; m < thread_count; m++)
              threads[m].join();
             long end = System.currentTimeMillis();
             System.out.println("using contended sync: " +
                          (end - start) + " ms");
    }

  • Generation of XML file from Java objects using castor

    I have the following java file(Customer.java).
    public class Customer
         private String ID;
         private FirstName firstName;
         private MiddleName middleName;
         private LastName lastName;
         private ArrayList address;
         public ArrayList getAddress() {
              return address;
         public void setAddress(ArrayList address) {
              this.address = address;
         public FirstName getFirstName() {
              return firstName;
         public void setFirstName(FirstName firstName) {
              this.firstName = firstName;
         public String getID() {
              return ID;
         public void setID(String id) {
              ID = id;
         public LastName getLastName() {
              return lastName;
         public void setLastName(LastName lastName) {
              this.lastName = lastName;
         public MiddleName getMiddleName() {
              return middleName;
         public void setMiddleName(MiddleName middleName) {
              this.middleName = middleName;
    Using castor i have created an xml file(customer.xml) which has the following format.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <customer ID="fbs0001">
    <FIRSTNAME>Fred</FIRSTNAME>
    <MIDDLENAME>B</MIDDLENAME>
    <LASTNAME>Scerbo</LASTNAME>
    - <ADDRESS>
    <FIRSTLINE>No 18, Sheshadri road</FIRSTLINE>
    <SECONDLINE>Gandhinagar Bangalore</SECONDLINE>
    </ADDRESS>
    - <ADDRESS>
    <FIRSTLINE>ITPL</FIRSTLINE>
    <SECONDLINE>Whitefield Bangalore</SECONDLINE>
    </ADDRESS>
    </customer>
    I have used a mapping file to get this output.Is there a way where i can get the output xml in the following format without changing the Java object structure.If yes then please suggest how this can be done.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <customer ID="fbs0001">
    <FIRSTNAME>Fred</FIRSTNAME>
    <MIDDLENAME>B</MIDDLENAME>
    <LASTNAME>Scerbo</LASTNAME>
    </customer>
    <ADDRESS>
    <FIRSTLINE>No 18, Sheshadri road</FIRSTLINE>
    <SECONDLINE>Gandhinagar Bangalore</SECONDLINE>
    </ADDRESS>
    - <ADDRESS>
    <FIRSTLINE>ITPL</FIRSTLINE>
    <SECONDLINE>Whitefield Bangalore</SECONDLINE>
    </ADDRESS>
    I mean the output xml file should have the address as a separate tag not withing the root tag customer.

    Hello,
    Castor's own discussion groups might be able to point you to the solution you're looking for (if this use case is possible using Castor).
    Oracle has its own object-to-XML mapping tool that is part of the TopLink product. It allows you to map existing objects to an existing XML Schema. This can be done visually using the TopLink Workbench, or programmatically using the TopLink APIs. TopLink OXM also supports the JAXB specification.
    Using TopLink OXM to get the desired XML result I would recommend the following. Map the Customer and Address classes to XML, but don't map the relationship between Customer and Address. Then make the calls to the marshaller something like the following:
    marshaller.marshal(aCustomer, System.out);
    for(int x=0; x<aCustomer.getAddress().size(); x++) {
         marshal(aCustomer.getAddress().get(x), System.out);
    Example - Using TopLink OXM to map an existing object model to an existing XML Schema:
    http://www.oracle.com/technology/products/ias/toplink/preview/10.1.3dp4/howto/ox/index.htm
    For more information on TopLink object-to-XML mapping:
    http://www.oracle.com/technology/products/ias/toplink/preview/10.1.3dp4/objectxml/index.html
    -Blaise

  • Empty strings when passing a Java object to a Stored Procedure

    Hi,
    I'm using the interface SQLData to pass Java objects to StoredProcedures. All the object's attributes 'arrive' to the Stored Procedure ok, except the strings, which are empty.
    Here is my Oracle object:
    TYPE OBJ_ASJFF_OBJ1 IS OBJECT (
    ARG1 CHAR(3),
    ARG2 NUMBER(4),
    ARG3 CHAR(4),
    ARG4 NUMBER(7),
    ARG5 NUMBER(13,2),
    ARG6 CHAR(1));
    The nested table of that object:
    TYPE TAB_ASJFF_OBJ1 AS TABLE OF OBJ_ASJFF_OBJ1;
    The procedure declaration:
    PROCEDURE Pup_Instaura_Processo (                              x_crCert IN TAB_ASJFF_OBJ1,
    x_cResult OUT CHAR(4)
    My SQLData implementation:
    public void writeSQL(SQLOutput stream) throws SQLException {
                   stream.writeString(getArg1());     
                   stream.writeInt(getArg2().intValue());
                   stream.writeString(getArg3());          
                   stream.writeLong(getArg4().longValue());     
                   stream.writeBigDecimal(getArg5());
                   stream.writeString(getArg6());
    Can anybody help me?
    Thanks in advance
    Rui Gonçalves

    not exactly what you wanted but ingredients can be found at
    - JPublisher's docuemntation (especially "Type Mapping Support Through PL/SQL Conversion Functions")
    - http://otn.oracle.com/sample_code/tech/java/jsp/Oracle9iJSPSamples.html (Best Hotels PL/SQL Sample )
    - http://otn.oracle.com/tech/xml/xdk_sample/xdksample_093001i.html
    hope this helps
    Kuassi
    I have a Java Stored procedure which takes an instance of a different java object as its parameter.
    I need to do this from a pl/sql package - can anyone point me to a sample etc (looked on the website but don't see one) ?
    Andrew

  • Problem with XMLEncoder for complex java object i

    Hi All.
    My problem with XMLEncoder is it doesnt transfrom java objects without default no arguement constructor. I was able to resolve this in my main java object class, by setting a new persistence delegate, but for other classes that are contained in the main class, they are not being encoded.
    Thanks in advance for your answers

    Better to put this in java forum :-)
    Just check, if this helps.
    http://forum.java.sun.com/thread.jspa?threadID=379614&messageID=1623434

  • Compare two Java Objects without Comparable / Comparator

    Hi Friends,
    I would like to compare two java objects (lots o attributes) without using Comparable / Comparator.
    Any suggestion/sample code would be helpful.
    Thanks,
    Sachin

    I suppose you could design another feature to compare Objects... but that would involve a design process, so asking for sample code is definitely premature. And as EJP says, what would be the point?
    At least that's what I would answer if this was one of those stupid interview questions.

  • How to reference multiple instances of the same Java object from PL/SQL?

    Dear all,
    I'm experimenting with calling Java from PL/SQL.
    My simple attempts work, which is calling public static [java] methods through PL/SQL wrappers from SQL (and PL/SQL). (See my example code below).
    However it is the limitation of the public static methods that puzzels me.
    I would like to do the following:
    - from PL/SQL (in essence it needs to become a forms app) create one or more objects in the java realm
    - from PL/SQL alter properties of a java object
    - from PL/SQL call methods on a java object
    However I fail to see how I can create multiple instances of an object and reference one particular object in the java realm through public static methods.
    My current solution is the singleton pattern: of said java object I have only 1 copy, so I do not need to know a reference to it.
    I can just assume that there will only ever be 1 of said object.
    But I should be able to make more then 1 instance of an object.
    To make it more specific:
    - suppose I have the object car in the java realm
    - from PL/SQL I want to create a car in the java realm
    - from PL/SQL I need to give it license plates
    - I need to start the engine of a scpecific car
    However if I want more then 1 car then I need to be able to refrence them. How is this done?
    Somehow I need to be able to execute the following in PL/SQL:
    DECLARE
    vMyCar_Porsche CAR;
    vMyCar_Fiat CAR;
    BEGIN
    vMyCar_Porsche = new CAR();
    vMyCar_Fiat = new CAR();
    vMyCar_Porsche.setLicensePlates('FAST');
    vMyCar_Porsche.startEngine();
    vMyCar_Fiat.killEngine();
    END;
    Thanks in advance.
    Best Regards,
    Ruben
    My current example code is the following:
    JAVA:
    ===
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED CODAROUL."RMG/BO/RMG_OBJECT" as package RMG.BO;
    public class RMG_OBJECT {
    private static RMG_OBJECT instance = new RMGOBJECT();
    private String rmgObjectNaam;
    private RMG_OBJECT(){
    this.rmgObjectNaam = "NonDetermined";
    public static String GET_RMGOBJECT_NAAM () {
    String toestand = null;
    if (_instance == null) {toestand = "DOES NOT EXIST";} else { toestand = "EXISTS";};
    System.out.println("instance : " + toestand);
    System.out.println("object name is : " + _instance.rmgObjectNaam);
    return _instance.rmgObjectNaam;
    public static Integer SET_RMGOBJECT_NAAM (String IN)
    try
    _instance.rmgObjectNaam = IN;
    return 1;
    catch (Exception e)//catch
    System.out.println("Other Exception: " + e.toString());
    e.printStackTrace();
    return 5;
    } //catch
    PL/SQL Wrapper:
    ==========
    CREATE OR REPLACE FUNCTION CODAROUL.SET_RMGOBJECT_NAAM(NAAM IN VARCHAR2) return NUMBER AS
    LANGUAGE JAVA NAME 'RMG.BO.RMG_OBJECT.SET_RMGOBJECT_NAAM (java.lang.String) return java.lang.Integer';
    Calling from SQL:
    ==========
    CALL dbms_java.set_output(2000);
    select CODAROUL.GET_RMGOBJECT_NAAM() from dual;
    Edited by: RubenS_BE on Apr 6, 2012 5:35 AM
    Edited by: 925945 on Apr 6, 2012 5:41 AM

    You can do this by manually creating a new iterator binding in your binding tab.
    So instead of dragging the VO directly to the page, go to the binding tab, add a new executable iterator binding, and point to that one from your ELs in the page itself.

Maybe you are looking for

  • Authentication : SSO &  WWV_CUSTOM-F_ security-group _ app_id

    Hi, In my application express application a user is authenticated by measn of single sign on. So when a user goes to 'http://myhost/pls/apex/f?p=101:1' he is redirected to the SSO server and when validated is redirected to 'http://myhost/pls/apex/f?p

  • QTY difference in STO invoice

    Hello Experts I am working with a STO process. When i create a STO PO  for Quantity 10 units with doc type UB and corresponding delivery  NL for 10 units Now when i Create a Proforma Invoice for the Deliivery. Below is the issue htat i face In the Ma

  • Architecture Considerations with AD RMS

    Hi, I'm looking to implement an AD RMS in an organization, and would like to find out more details on some architectures that I have come up with and hopefully some advice and which is better. Architecture 1: 2 Physical Servers for AD RMS and MSSQL O

  • Importing 2 icloud photo streams into iPhoto

    Just as the title states.. My wife and I just started our own seperate iCloud accounts and now it seems like we can't combine them in iPhoto.  Before we used one account and pictures were seamlessly across all devices, and now since iOS 8 and continu

  • PSE 7 always "Updates" on opening - why?

    I recently installed Photoshop CS4 alongside my existing copy of Elements 7. Ever since, whenever I open Elements, it immediately displays a dialog saying; "Updating" and a progress bar. This process takes several minutes and seriously impedes my wor