Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:3.0
I have category objects inside content object with
ONE TO MANY relationships.
My Mapping for SET tag is working but it is taking much time to load the data in JSP page.
Could you please suggest us in performance tunning the SET TAG.
1. Is it advisiable to use
lazy="true" in
set tag
2. What makes the difference in using [b]batch-size in set tag and content class.
Also could you suggest us what would be the reasons for low performance(loading of database records) using the collections like
<SET
In below example:
persistence.ContentCategory is the collection of objects to be loaded along with "persistence.Content" objects.The relations ship is simple and it is working.But there is performance hit if the number of content objects are more then 10 records.
-----------------------------------------------------
Content mapping file.
<?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="persistence.Content" table="content">
<id name="contentId" column="content_id" type="long">
<generator class="sequence"/>
</id>
<set name="contentsAndCategories" table="content_category" cascade="all" lazy="false">
<key column="content_id"/>
<[b]one-to-many class="persistence.ContentCategory"/>
</set> [/b]
</class>
</hibernate-mapping>
---------------------------------
Mapping file related to the collection for a set tag in the content mapping object.
<?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="persistence.ContentCategory" table="content_category">
<id name="contentCategoryId" column="content_category_id" type="long">
<generator class="sequence"/>
</id>
<
many-to-one name="content" column="content_id" class="persistence.Content" lazy="false" />
</class>
</hibernate-mapping>