Reputation: 6143
I've stumbled upon Oracles XML DB functionality, but so far, from my reading I only see examples with JDBC implementations.
This is one of the examples:
import oracle.xdb.XMLType;
...
PreparedStatement stmt = conn.prepareStatement(
"SELECT e.poDoc FROM po_xml_tab e" );
ResultSet rset = stmt.executeQuery();
while( rset.next() ) {
// get the XMLType
XMLType poxml = ( XMLType )rset.getObject( 1 );
// get the XML as a string...
String poString = poxml.getStringVal();
}
According to the official xml db developers guide, there is an option to store data in a object-relational (structured) format. This makes me think that there should be an almost seamless link between XML DB and JPA. Maybe I'm missing something, or maybe it just doesn't exist?
Can they work together? Are there other options than JDBC? Or can I just do JPA for the queries, and the JDBC for XML?
Edit: Is Oracle XML DB even worth using it? Since it doesn't look like anyone uses it (according to the views and responses so far).
Upvotes: 2
Views: 874
Reputation: 18379
You can use Oracle XDB features from JPA. If you have a column of an XMLType you can map it into a JPA Entity using a @Basic mapping to a String.
In EclipseLink you could use a Converter to map it to another data-type, or use the DirectToXMLTypeMapping to map the DOM.
If you want to map the XML to objects, you could use a Converter that uses JAXB.
Upvotes: 2