This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate mapping using Oracle XML" Watch "Hibernate mapping using Oracle XML" New topic
Author

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 ]
 
Don't get me started about those stupid light bulbs.
 
subject: Hibernate mapping using Oracle XML
 
Similar Threads
mapping question (hashmap and subclasses)
Simple mapping issue for Hibernate newbie
argument in form access
Problem with one-to-one mapping using discriminator
Hibernate - multiple collection with restrictions mapping problem