-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Dom4j XML Mappings limit select query
PostPosted: Thu Jun 29, 2006 5:36 pm 
Newbie

Joined: Wed Apr 12, 2006 1:01 pm
Posts: 5
Hello All,
We are using hibernate DOM4j mappings to save data into a database. The xml document is broken into component parts and saved to relevant columns to optomize searching and a full XML record is saved to the same table as well. Here is a mapping excerpt:

Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
   <typedef class="gov.wisconsin.wijis.util.XsdDateType" name="xsd_date" />
   <typedef class="gov.wisconsin.wijis.util.WijisDateType" name="wijis_date" />   

   <class entity-name="personActivityHeader" table="PERSON_ACTIVITY_HEADERS" node="personActivityHeader" >
      <id name="id" column="pk_ID" node="@id" type="int">
         <generator class="native" />
      </id>
      <property name="submitter" node="submitter" type="string" index="ix_pah_sub" />
      <property name="sortedKeyData" node="sortedKeyData" type="string"  index="ix_pah_skd" />
      <property name="recordCaption" node="recordCaption" type="string" index="ix_pah_rc"/>
      <property name="recordholderCaption" node="recordholderCaption" type="string" index="ix_pah_rhc"/>
      <property name="personFirstName" node="personFirstName" type="string" index="ix_pah_pfn" />
      <property name="personLastName" node="personLastName" type="string" index="ix_pah_pln" />
      <property name="personMiddleName" node="personMiddleName" type="string" index="ix_pah_pmn" />
      
       <property name="serializedForm" column="XML_DATA" type="text"  node="serialized" />      
   </class>
   
</hibernate-mapping>
       
   



When we do a search (as opposed to a save), we go to retrieve records from the database and the only entity we are interested is the 'serializedForm' which is the entire data item as XML. However, due to our mappings all columns are selected, see the following sql:

Code:
select this_.pk_ID as pk1_0_0_, this_.submitter as submitter0_0_, this_.sortedKeyData as sortedKe3_0_0_, this_.recordCaption as recordCa4_0_0_,
this_.recordholderCaption as recordho5_0_0_, this_.personFirstName as personFi6_0_0_, this_.personLastName as personLa7_0_0_, this_.personMiddleName as per
sonMi8_0_0_, this_.birth_year as birth9_0_0_, this_.birth_month as birth10_0_0_, this_.birth_day as birth11_0_0_, this_.activity_year as activity12_0_0_, t
his_.activity_month as activity13_0_0_, this_.activity_day as activity14_0_0_, this_.XML_DATA as XML15_0_0_, this_.birth_year as formula0_0_, this_.birth_m
onth as formula1_0_, this_.birth_day as formula2_0_, this_.activity_year as formula3_0_, this_.activity_month as formula4_0_, this_.activity_day as formula
5_0_ from PERSON_ACTIVITY_HEADERS this_ where this_.personFirstName like ? and this_.personLastName like ? order by this_.personLastName asc


Is there a way to limit this select to just select: this_.XML_DATA?

Thanks for any insight you can offer!

Yogesh


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 14, 2006 4:13 am 
Newbie

Joined: Mon Mar 20, 2006 8:42 am
Posts: 11
what is the query that you are using to get the record?

_________________
Aisha


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.