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)

Similar Messages

  • How to return java objects on the button click

    hello all,
    i wonder if any body let me know ,how to return java objects on button click,
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    class base
         base()
              JFrame frame = new JFrame("Base class Message Dialog Box");
              JPanel panel = new JPanel();
              JButton buttonchildone = new JButton("Child class one");
              buttonchildone.addActionListener(new ActionListener(){
                   public actionPerformed(ActionEvent e)
                        childone ch1=new childone();
                   return ch1;
              JButton buttonchildtwo = new JButton("Child class two");
              buttonchildtwo.addActionListener(new ActionListener(){
                   public void actionPerformed(ActionEvent e)
                        childtwo ch2=new childtwo();
                        return ch2;
              panel.add(buttonchildone);
              panel.add(buttonchildtwo);
              frame.add(panel);
              frame.setSize(300, 300);
              frame.setVisible(true);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         void show()
              System.out.println("Base class show() method");
    public class mainmethod
         public static void main(String[] args)
              base baseobj=new base();
    here my aim is to achieve dynamic polymorphism by button click's ,where based on the button click i can send back an object of childone or childtwo classes
    thanks and regard
    Mac
    Message was edited by:
    LoveOpensource

    You probably need to rethink your design. Where are these child classes going? What is using or consuming them? I agree with the message above about a button instantiating a parent field variable to one child or the other depending on which button is pressed.
    Message was edited by:
    petes1234

  • How to convert Java Objects into xml?

    Hello Java Gurus
    how to convert Java Objects into xml? i heard xstream can be use for that but i am looking something which is good in performance.
    really need your help guys.
    thanks in advance.

    There are apparently a variety of Java/XML bindings. Try Google.
    And don't be so demanding.

  • How to store java objects in the database

    Hi,
    I am trying to store HttpSession state across Application Servers. Basically I am trying to build a sort of application cluster server on my own. I thought the best way to do this was to periodically store the HttpSession object from an application server in a database.
    I created a table in Oracle 8i with a blob column. I use a PreparedStatement.setObject() method to store the HttpSession object in the database. My problem is, I don't know how to get the object back from the database.
    Since ResultSet.getBlob returns the Blob locator, I need to read the BinaryInputStream to get all my data back. This tells me that getBlob basically works only for things like files, and cannot be used for Java objects.
    Is there any way around this? Your input would be much appreciated.
    Regards,
    Somaiah.

    Thanks for the quick reply vramakanth.
    Do I have to use a type map if I do this? Also does such a type map exist for the HttpSession class?
    Thanks,
    Somaiah.

  • Newbie question on how to return java objects from java stored procedures

    Hi,
    As you may guess, i'm new to this.
    I have a stored procedure that does some calculations and creates a list of java objects as the result of the query.
    How would I return the list from the database to the client application?
    Would I have to create an Oracle type that maps to the java object?
    Please help.
    Jag

    Hi Jag,
    Your question is very vague (to me). Perhaps you could post what you have done so far? Have you tried looking through the Sample Code page of the Technet Web site, or tried searching the Ask tom Web site, or MetaLink?
    Good Luck,
    Avi.

  • How to read Java Object message from JMS Queue using JMS Adapter .

    Dear All,
    In my scenario i have to read a java object message from JMS Queue . I tried by using the JMS Adaper ,but i am not getting any Payload . Can any one tell me is there any special settings for JMS Adapter to read the Java Object message .
    I am able to read the Message successfully thru JMS Adapter but in SXMB_MONI it is not showing any payload .
    I also went in Message monitoring but i am getting this type of message in Sender JMS Adapter  in Audit Log.
    JMS Message ID XXXXX Message Type Null unknown.Payload can not be read and will be empty.
    JMS Message ID XXXXX Payload Empty can not read.
    Please Help.
    Lateef

    Hi,
    As far as i know, JMS Object Messages is not supported by XI JMS adapter.
    you need to have the JMS provider to transform the message to bytes messages.
    (Refer to SAP note 856346)

  • How to generate Java objects from XML files with out  scema compilation

    Dear participants,
    My name is Raghavendra , i have a requirement of reading XML files Dynamically and parse them and create java types for manipulation . i will not be provided with sxd files (no schema compilation )coz no one knows how many types of structures are there. i want a generic solution. Please Help.
    Thanks ,
    Raghavendra Ach
    you can mail me to " [email protected]"

    georgemc wrote:
    You could also look at something like Apache Digester, which will parse your XML and populate Java objects with the data. A slightly steeper learning curve than the lower-level APIs such as JDOM, but that's outweighed by the lesser development effortdon't think that would work for the original problem, which seemed to indicate that the xml had an unknown structure.

  • How to Pass Java Objects between Web Dynpro and Java SAP iViews

    Basically I have an SAP web dynpro iView that I do stuff with and I want to pass an object to another iView which is just a regular Java iView. From what I've read and tried, I can't just stick something in the session object and hope that the Java iView can pull it down the other end. I had a dream that it was possible (seriously).
    Anyway, are there any possible solutions around? Please advice and share you throughts. I will try to dream about it again tonight and see if its really gonna work this time.
    thanks for your help in advance

    There is no easy way you can pass objects other than those supported by express such as String, map, list etc.
    Though not advised, you can create a class with static variables to handle the storage of such java objects during transition between form and workflow. You will need to somehow identify the objects uniquely .

  • How to store java object in oracle

    Hi all,
    is it possible to store jva object in oracle.
    I have defined myClass. It have only data fields ( no methods).
    I make myClass myObject = new myClass();
    How can I store this object in oracle DB.
    Many thanks in advance.

    1.Convert this object into stream of Bytes.
    2.create a new InputStream from these Byte array.
    2.Use the setBinaryStream to set the values inside the table's column.
    3.Store this object as a Blob in the table (column type must be Blob).
    Hope this helps.
    Sudha
    PS:- Somebody explained in this forum how to convert an Object into Byte array .

  • How to convert java object to xml?

    Is JAXB the only way to do so?
    Can somebody help me?
    I have tried for almost a week,
    but I am failed all the time.

    Sax would be the best way to do it,
    Create a class that implements the org.xml.sax.XMLReader interface. Fire events at its ContentHandler (like open tag, element content characters, and close tag) and it can be used to create a javax.xml.transform.sax.SAXSource.
    I learnt how to do this by looking at example code that comes with the pache FOP project. They have a class which is "converted" to XML, and that output is fed through a transformation. I cribbed their code and used it in mine. Including their helper classes AbstractObjectReader and EasyGenerationContentHandlerProxy which help a lot.
    Of course you never see the XML from the object, that's just a transitional form, but you COULD output that if you wanted. Take a look at http://xml.apache.org/fop/ - the code is bundled with the installation under the "examples" directory.

  • How to call Java Objects from ESB?

    I don't know whether its possible but if there is a way please let me know I'd really appreciate.
    I'm sending message to the JMS queue and I've created JMS adapter that I expect to be triggered when message gets into the queue. The message is an xml file that I read and look up some values that are Java classes and methods that I want to call. So how do I configure ESB to call Java Classes. I tried to look at the routing rules.
    Regards

    You could create the wsdl yourself and instead of the soap:binding use the java:binding
    not sure if this works...just a guess.

  • How to transform common object to xml string

    I know that I can import xml dtd a the common data type in iStudio. However, does anyone know how to serialize it back to the xml string during the field mapping? Is it even possible?
    Thanks,
    Edward

    Thanks Stuart for your reply. What I'm trying to do is to convert the xml message from the common view object to JMS Text Message. I declared the application data type as AQ$JMS_TEXT_MESSAGE and I try to map the common data type which is I imported from dtd to the application JMS type. During the mapping I need to serialize the common data type object back to xml string, so I can copy it to text_vc field defined in JMS Text Message (String type).
    Or do you know any other alternative to convert from RAW XML payload type to JMS payload type in iStudio?
    Thanks,
    Edward

  • How to use Java objects in business rules 11g

    I have made one business rule with two XML facts and then follow one doc to create the java facts.But I am unable to use the facts.

    No Java Facts are created,but as I have mentioned XML input and output facts at the time of creation of business rules,so I am not able to use java fact in business rule.
    Edited by: 856272 on Jan 4, 2012 6:22 AM

  • Blaze DS - Mapping java object into another java application

    Good afternoon,
    I realized a Client-Server application. Server is Java-based. Client is Flex. Server services are accessible through Blaze DS.
    Now I have some Java clients that need to access server services. Blaze DS permits to do it simply but I don't know how to map java objects as I do using [RemoteClass(alias.....)] construct at Actionscript side.
    For example, server sends a MyObjectType and client receives an ASObject.
    Is there a way to map java MyObjectType automatically at destination?
    Thank you for help and sorry for poor english.
    Regards, Francesco

    xstream will convert any given java object to xml. Not sure what support it offers for schemas.
    http://xstream.codehaus.org/

  • Ho to store java objects in oracle database

    HI
    for me the sceanario is,
    i neeed to create , dynamically a table at the time of specified action.
    i need to store the values retreieved from session and store it in a database..
    for example
    User usr=session.getAttribute("usr"); i need to store the user object.
    and hashtable and hashmap values without iterating.
    please suggest at the earliest
    can it be done?
    Regards,
    Ramesh

    my requirement is like that,bcos of two different weblogic servers need to acess the central database.which contains user information.
    The user object from first server will be stored in database.and the second server will retrieve the user information and it will set for its application.
    please suggest me how to store java objects in database.
    regards,
    Ramesh

Maybe you are looking for

  • Special Periods

    Hi Guys, I could not understand the following. Can anyone elaborate with example- " If you do not need 12 posting periods, you can use the posting periods that are not required as special periods. If you use these additional closing periods, you must

  • Reg.Reconciliation account in Customer master XD01

    Dear All I donn't know where to add reconciliation account for customer master (XD01), I create G/L account,G067-Reconciliation account.Next what I should do for that G/L acc should come to customer master Rec.Acc. Please help me

  • Why is all my RAM being taken up with just Google Chrome being run?

    As you can see, basically all of my memory is being taken up with just activity monitor and google chrome being run. Google Chrome has just three tabs open.. The CPU is fine 93% idle. Please can someone help/explain cause I this is very annoying!

  • Iwant the following  program to be visible  as Java Application

    Hi for all Iwant the following program to be visible when it is runned in java application the program is compiled correctly , but when it is runned as an application the, following message appears press any key to continue... That is a common proble

  • Facetime wont finish logging in

    When i try to log in to facetime on my mac book pro it says this , "the server encountered an error processing registration. please try again. " why is this ? someone please help ? I upgraded, bought mountain lion, added dns to my network and nothing