• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate mapping using Oracle XML  RSS feed

Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!