Hi,
I have two tables called document and documentattachement. documentattachement table has a foreign key in its documentid column which refers to the document tables's documentid(primary key). So when i load a document object using the HQL, all the documentattachement objects are getting loaded as a collection in the document entity class. But i need only the document objects to get loaded with out the one to many set (which contains the documentattachements for a document) not loaded in the document entity class. For accompolishing this have i to set any parameters in the hbm files or is there any other ways for doing this. I had tried this with many options. But not yet got how to do it. Any help would be really greatful to me.help me to write out this query.
i had provided the hbm files below
document.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jun 11, 2007 5:51:25 PM by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping>
<class name="com.stabilix.felix.dms.entities.Documententity" table="DOCUMENT" >
<id name="documentid" type="long">
<column name="DOCUMENTID" precision="14" scale="0" />
<generator class="increment" />
</id>
<property name="documentversion" type="string">
<column name="DOCUMENTVERSION " />
</property>
<property name="sensitivity" type="string">
<column name="SENSITIVITY" length="50" />
</property>
<property name="createdon" type="timestamp">
<column name="CREATEDON" length="11" />
</property>
<property name="createdbyid" type="string">
<column name="CREATEDBYID" />
</property>
<property name="tite" type="string">
<column name="TITE" />
</property>
<set name="documentattachements" inverse="false">
<key>
<column name="DOCUMENTID" precision="12" scale="0" />
</key>
<one-to-many class="com.stabilix.felix.dms.entities.Documentattachement" />
</set>
</class>
</hibernate-mapping>
documentattachement.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jun 11, 2007 5:51:25 PM by Hibernate Tools 3.2.0.b9 -->
<hibernate-mapping>
<class name="com.stabilix.felix.dms.entities.Documentattachement" table="DOCUMENTATTACHEMENT" >
<id name="fileid" type="long">
<column name="FILEID" precision="14" scale="0" />
<generator class="increment" />
</id>
<many-to-one name="document" class="com.stabilix.felix.dms.entities.Documententity" fetch="select">
<column name="DOCUMENTID" precision="12" scale="0" />
</many-to-one>
<property name="filename" type="string">
<column name="FILENAME" />
</property>
<property name="languageid" type="java.lang.Long">
<column name="LANGUAGEID" precision="12" scale="0" />
</property>
<property name="status" type="string">
<column name="STATUS"/>
</property>
</class>
</hibernate-mapping>
Thanks in advance,
Jim
|