[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5436) different lock deepness for joined subclass

kakusi kakusi (JIRA) noreply at atlassian.com
Wed Aug 4 09:25:40 EDT 2010


different lock deepness for joined subclass
-------------------------------------------

                 Key: HHH-5436
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5436
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.3.2, 3.2.5
         Environment: Oracle 10g
            Reporter: kakusi kakusi


Hi,

we use hibernate, oracle and pessimstic locking, to avoid concurrent modification through different threads.
This worked fine for a while. But now we sometimes get deadlocks. We analyzied and found the cause: we produced locks with different deepnesses for objects of type joined subclass.

An example for our kind of mapping:

{noformat} <class name="TraceObject" table="TraceObjects">
		<cache usage="read-write" />
		<id name="objectId" column="objectId" type="long">
			<generator class="native">
				<param name="sequence">TraceObjectsSeq</param>
			</generator>
		</id>
		<timestamp name="dbVersionControl" />
		...
	</class>

<joined-subclass name="VehicleObject" table="VehicleObjects" extends="TraceObject">
	<key column="id" />
	...
</joined-subclass>{noformat} 


Method:
{{session.get(Class clazz, Serializable id, LockMode lockMode);}}
Created Select-Statement: 
{{SELECT traceobjec0_.objectId ... FROM TraceObjects traceobjec0_ LEFT OUTER JOIN VehicleObjects traceobjec0_3_ ON traceobjec0_.objectId=traceobjec0_3_.id WHERE traceobjec0_.objectId=? FOR UPDATE;}}
Effect:
This locks the relevant data in table TraceObjects and joined table VehicleObjects.

Method:
{{session.get(Class clazz, Serializable id);}}
{{session.lock(Object object, LockMode lockMode);}}
Created Select-Statement: 
{{select traceobjec0_.objectId ... from TraceObjects traceobjec0_ left outer join VehicleObjects traceobjec0_3_ on traceobjec0_.objectId=traceobjec0_3_.id where traceobjec0_.objectId=?;}}
{{select objectId from TraceObjects where objectId =? for update;}}
Effect:
This only locks the relevant data in table TraceObjects.

We think this is a bug, because all techniques to lock should create the same lock type (only locking the parent table).



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list