-->
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: why does hibernate generate lock with locked_mode=2
PostPosted: Tue Dec 14, 2010 5:50 am 
Newbie

Joined: Tue Dec 14, 2010 4:54 am
Posts: 1
why does hibernate generate lock with locked_mode=2 in oracle

The entities are as below, I am using oracle database.
Code:
@Entity
public class Customer {
   private Set<Order> orders;

   @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true)
   public Set<Order> getOrders() { return orders; }

   public void setOrders(Set<Order> orders) { this.orders = orders; }

   [...]
}

@Entity
public class Order { ... }



when I debug below code, I have set below debug breakpoint.

Customer customer = (Customer) sess.load(Customer.class, new Long(1) );
customer.setName("PK");
session.flush(); // set debug breakpoint here

excute below sql:
Code:
SELECT DISTINCT b.username,
  c.owner                 ,
  c.object_name           ,
  locked_mode             ,
  b.sid                   ,
  b.serial#               ,
  b.status                ,
  b.osuser                ,
  b.machine
   FROM v$locked_object a ,
  v$session b             ,
  dba_objects c
  WHERE b.sid   = a.session_id
AND a.object_id = c.object_id
AND OBJECT_NAME NOT LIKE 'MLOG%'
ORDER BY object_name

result:
Code:
username    owner          object_name       locked_mode         sid         serial#  status           osuser     machine
IIAPP        IIAPP_USER       CUSTOMER           3                54         55797   INACTIVE          c_jyin      FB-XP3
IIAPP        IIAPP_USER       ORDER              2                54         55797   INACTIVE          c_jyin       FB-XP3


Can someone help to explain why hibernate generates above lock for ORDER (which's locked_mode is 2)?
I don't need this lock. How can I remove this lock? (note I aleady tried to switch isloation level between read commited and serialzible)


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.