This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate mapping using Oracle XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate mapping using Oracle XML" Watch "Hibernate mapping using Oracle XML" New topic

Hibernate mapping using Oracle XML

Sverre Moe
Ranch Hand

Joined: Jul 10, 2007
Posts: 110
Before I begin with my problem let me explain my hibernate setup. Hope you will bare with me and not leave in the middle of the explanation .

I have a primary table called Automobile, with a secondary table called AutomobileDetails. The AutomobileDetails contain some attributes to connect to Automobile, and a string value which is an XML.

Some(not all) Automobiles have a connection to ONE AutomobileDetails.
I have defined a discriminator-value in the mapping to Automobile for those who do have such a connection. In this discriminator I have defined a <many-to-one> to the AutomobileDetails. This many-to-one is tied to the mapping of AutomobileDetails.

In the setter method for this automobileDetails I have an XML parser which goes through the XML string og populates the values in differenct variables in the mapped object.

I have discovered that Oracle can do this for me, but I am not sure how to set this up in my Hibernate mapping.

The following SQL is used to get a single value from this XML string

I could set up a <property formula=""/>, and define the SQL select in this formula for the test variable, but I need to pass two paramter in this formula from the primary keys of the hibernate mapping Automobile. Could I do this or is it some other way I could populate these variables with the values from this XML string?

Something like this maybe (:id1 and :id2 refers to the primary keys)?

In addition to retrieving the data in the AutomobileDetails I also want to update them when the Automobile object is stored. Volvo is a subclass of Automobile.
[ May 19, 2008: Message edited by: Sverre Moe ]
I agree. Here's the link:
subject: Hibernate mapping using Oracle XML
It's not a secret anymore!