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 hereexcute 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)