Storing XML in Entity Beans?


XML & Web services: Storing XML in Entity Beans?

  1. Storing XML in Entity Beans? (4 messages)

    What are some common practices in storing XML data in a J2EE application? My co-workers want to store the XML String directly in an entity bean.

    We are attempting to use CMP entity beans first but the problem is that Java Strings are translated to VARCHAR(256) and our XML documents are definitely longer than 256 characters. I believe we can use BMP instead and persist the XML string to the data type TEXT.

    Another approach is to store an object graph of the XML document. This graph would be very similar to the DOM tree for the XML. This seems to be a lot of work for merely persisting XML documents. The parsing and serializing of the objects may prove too costly.

    What are your thoughts in this matter?

    Charles Ng
    Senior Internet Developer
    cng at internetivity dot com
    613-729-4480 x305

    InterNetivity Inc. - The Information Outreach Pioneer
    Visit The Analysis Engine for the Web at

    Threaded Messages (4)

  2. Storing XML in Entity Beans?[ Go to top ]

    I tpp would like to know about it. What more i can think of is how to create an XML doc from the resultset i obtain. Are there any APIs available which are doing this or i have to create one of my own.
  3. Storing XML in Entity Beans?[ Go to top ]


    Though not platform independent, check out XSQL from Oracle.
  4. Storing XML in Entity Beans?[ Go to top ]

    Have you tried looking at what storing the data as a CLOB will do for you?
  5. Storing XML in Entity Beans?[ Go to top ]

    We've just done something similar here. We use CMP for the main properties of an XML document, (id, name, type, etc..), and use BMP (via set() and get() methods) for setting CLOB's in an oracle database via a DataSource. We wrap it round a stateless bean which has methods for pulling the CLOBs out of the DB quickly as well. Works very well.