These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Different SQLs by Hibernate 3.1 and Hibernate 3.0.3
PostPosted: Thu Jun 22, 2006 11:51 am 
Newbie

Joined: Thu Jun 22, 2006 11:02 am
Posts: 1
Hibernate 3.1 and Hibernate 3.0.3

<hibernate-mapping package="com.abc.mypackage">
<class
name="MyClass"
table="parent_table_role"
mutable="true"
>
<cache usage="transactional" region="myregion"/>

<id
name="roleId"
type="integer"
column="role_id"
unsaved-value="any">
<!-- generator class="assigned"/ -->
<generator class="org.hibernate.id.MultipleHiLoPerTableGenerator">
<param name="table">sequences</param>
<param name="primary_key_column">seq_name</param>
<param name="value_column">next_id</param>
<param name="primary_key_value">CM_ROLE</param>
<param name="max_lo">100</param>
</generator>
</id>
<property name="version" column="version" type="integer" not-null="true" length="10"/>
<property
name="roleName"
column="role_name"
type="string"
not-null="false"
length="50"
/>
<property
name="roleDesc"
column="role_desc"
type="string"
not-null="false"
length="255"
/>
<set
name="users"
table="child_table_user_roles"
cascade="all"
>
<key column="user_role_id"/>
<composite-element class="MyRoleDetails">
<property name="approving"
column="approving"
type="integer"
not-null="false"
update="true"
insert="true"
length="10" />
<property name="version" column="version" type="integer" not-null="true" length="10"/>

<property name="userId"
type="integer"
update="true"
insert="true"
column="user_id"
length="20" />

</composite-element>
</set>
</class>
</hibernate-mapping>

for (iter = myRoles.iterator(); iter.hasNext();) {
MyClass aRole = (MyClass)iter.next();

MyClass role = (MyClass)session.load(MyClass.class, aRole.getRoleId());
MyRoleDetails details = new MyRoleDetails();
details.setUserId(userId);

role.getUsers().remove(details);
session.update(role);
}

Hibernate 3.0.3 library generated this SQL :
Hibernate: delete from child_table_user_roles where user_role_id=? and approving=? and version=? and
and user_id=? :


Hibernate 3.1 library generated this SQL :
Hibernate: delete from user_roles where user_role_id=? and version=?


Look at the different SQLs generated by Hibernate libraries (one is 3.0.3 and the other is 3.1).
The difference of the above two SQLs generated is causing me a huge grief.

I like someone to tell me "this is an intended difference or a bug in Hibernate 3.1".

Thanks for your help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.