Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Hibernate 2.1.8
Mapping documents:
see below....
Code between sessionFactory.openSession() and session.close():
n/a/
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
I am on a hibernate 2 project and noticed that retrieving an instance of a class with the following set:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.blah.TaskSet" table="mbl_task_set">
<id column="ts_id" name="id">
<generator class="com.blah.TableNextRowIdGenerator">
<param name="name">mbl_task_set</param>
</generator>
</id>
<property name="userName" column="ts_user_name" not-null="true" length="24"/>
<property name="taskSetName" column="ts_name" not-null="true" length="40"/>
<property name="source" column="ts_source" not-null="true" length="10"/>
<set name="paramData" lazy="false" inverse="true" cascade="all">
<key column="tpd_ts_id"/>
<one-to-many class="com.blah.TaskParameterData"/>
</set>
</class>
</hibernate-mapping>
When retrieving the class with the set it Caused the class to do a loop through all above TaskParameterDatas in the set rather than doing a join.
Is this a Hibernate 2 problem that is fixed in Hibernate 3?
See output below:
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?
Hibernate: select mbl_task0_.tpd_id as tpd_id__, mbl_task0_.tpd_id as tpd_id, mbl_task0_.tpd_ts_id as tpd_ts_id, mbl_task0_.tpd_seq_id as tpd_seq_id, mbl_task0_.tpd_data as tpd_data from mbl_task_param_data mbl_task0_ where mbl_task0_.tpd_ts_id=?