Joined: Thu Aug 16, 2007 11:42 am Posts: 2
|
Hibernate version: 3.2
Mapping documents:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Kategoria.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">
<hibernate-mapping> <class name="pl.com.album.blc.Kategoria" table="kategoria"> <id name="id" column="id"> <generator class="native"/> </id> <property name="description" column="nazwa" not-null="true"/> <set name="obrazki" table="obrazekwkategorii" lazy="true"> <key column="idKategorii" /> <many-to-many column="idObrazka" class="pl.com.album.blc.Obrazek"/> </set> </class> </hibernate-mapping>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Obrazek.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"> <hibernate-mapping> <class name="pl.com.album.blc.Obrazek" table="obrazek"> <id name="id" column="id"> <generator class="native"/> </id> <property name="nazwa" column="nazwa" /> <property name="nazwaPliku" column="nazwapliku" not-null="true"/> <property name="czasDodania" column="czasdodania" not-null="true"/> <property name="obrazek" column="obrazek" length="1048576" not-null="true" lazy="true"/> <property name="miniatura" column="miniatura" lazy="true"/> <set name="kategorie" table="obrazekwkategorii" > <key column="idObrazka" /> <many-to-many column="idKategorii" class="pl.com.album.blc.Kategoria"/> </set> </class> </hibernate-mapping>
Hi. How can I write Hql query to fetch Kategoria with collection obrazki. The collection should be initializeb but not at all. Collection contains Obrazki and I don't wan't to initialize obrazek property and miniatura property because of it's size. It contains Image data and Thumbnail data.
How can I fetch collection in this case. I was looking for this on forum but found only this.
Use lazy="true" on <component>, and <property> mappings to enable lazy loading of individual scalar value-typed properties (a somewhat exotic case). Requires bytecode instrumentation of compiled persistent classes for the injection of interception code. Can be overriden in HQL with FETCH ALL PROPERTIES.
Is there any other way to acheve this?
Please help...
|
|