Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Recommended way to store XML data with EL
Recommended way to store XML data with EL [message #540468] Wed, 16 June 2010 09:37 Go to next message
marco is currently offline marcoFriend
Messages: 21
Registered: May 2010
Junior Member
Hi,

I am looking for a best practice solution for storing XML data in a database with EL. I receive an XML document from a WS (using Apache CXF) which is unmarshaled to an object structure using JAXB. After some processing, I would like to store the data in a MySQL db using JPA/EL. I don't need to query or manipulate the data later on - i.e., the data could be stored as a BLOB. I thought about marshaling the data to a byte[] or to a string (preferable) and store it as a property of an entity.
Is there any better solution supported by EL or should I go with the marshaling approach (if so, are there any major performance differences between marshaling to byte[] or string)?

Thanks in advance for your thoughts.

marco
Re: Recommended way to store XML data with EL [message #540563 is a reply to message #540468] Wed, 16 June 2010 14:21 Go to previous messageGo to next message
Blaise Doughan is currently offline Blaise DoughanFriend
Messages: 163
Registered: July 2009
Senior Member

Hello Marco,

For this particular use case (receive XML, store XML as BLOB in database), I would recommend not using JAXB at all. Are you able to change your web service client to recieve the data as XML instead of POJOs?

If you want/need to receive the data as POJOs then assuming you are using the default UTF 8 encoding it is noticably faster to write to a byte[] using ByteArrayOutputStream than to write to a String using StringWriter (atleast it is for EclipseLink JAXB).

-Blaise
Re: Recommended way to store XML data with EL [message #540792 is a reply to message #540468] Thu, 17 June 2010 11:41 Go to previous message
marco is currently offline marcoFriend
Messages: 21
Registered: May 2010
Junior Member
Hello Blaise,


thanks for your advices. If possible (also from a requirements point of view), I will try to avoid using JAXB at the CXF interface. Anyway, I will persist the entire message as a byte[] as you suggested.


regards,
marco

Previous Topic:PluralAttribute.getJavaType returns element type instead of collection type
Next Topic:Readonly ManyToMany mapping?
Goto Forum:
  


Current Time: Fri Mar 29 15:22:33 GMT 2024

Powered by FUDForum. Page generated in 0.03394 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top