java - How to let Hibernate 3 to retrieve a value only when its getter is called -
i have hibernate 3 mapping of table medium text field. table has few thousands records, other medium text field, other fields not hold data @ all.
the whole table needs loaded memory except medium text field, used.
although have heard of lazy fetching annotation, legacy piece of code using hibernate xdoclet, not mention lazy fetching in hibernate property definition:
http://xdoclet.sourceforge.net/xdoclet/tags/hibernate-tags.html#@hibernate_property_0_1_
so there way tell hibernate retrieve value when getter called?
hibernate default supportd lazy fetching unless exlplicity set eager fetching. if want idea on lazy fetching refer this
if property laza loading try like
<?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping > <class name="db.hibernatesimple.copay" table="ehr_copay" polymorphism="explicit" > <id name="id" column="copay_id" type="long" unsaved-value="null" > <generator class="sequence"> <param name="table">hival</param> <param name="column">next</param> <!-- add non xdoclet generator parameters, create file named hibernate-generator-params-copay.xml containing additional parameters , place in merge dir. --> </generator> </id> <property name="balance" type="int" column="balance" length="10" /> <property name="date" type="java.lang.string" column="ownership_date" /> <property name="comments" type="java.lang.string" column="comments" lazy="true" /> <many-to-one name="user" class="db.hibernatesimple.user" cascade="none" outer-join="auto" column="user_id_seq" />
i extracted above here can idea guess
Comments
Post a Comment