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