Logging JDBC/Hibernate/JPA transaction isolation levels?

You should set the transaction isolation level of hibernate as 2 (the java.sql. Connection constant for READ_COMMITTED.

You should set the transaction isolation level of hibernate as 2 (the java.sql. Connection constant for READ_COMMITTED. Then execute the following in your SQL Server 2005 instance (with no active connections): ALTER DATABASE database_name SET ALLOW_SNAPSHOT_ISOLATION ON; ALTER DATABASE database_name SET READ_COMMITTED_SNAPSHOT ON; Test by executing this query: SELECT name, snapshot_isolation_state_desc, snapshot_isolation_state, is_read_committed_snapshot_on FROM sys.

Databases WHERE name = 'database_name'; Now a READ_COMMITTED will be interpreted as READ_COMMITTED_SNAPSHOT in SQL Server.

I would like to describe an issue I got on JPA/MySQL; it may inspire your investigations... Global transaction begin transaction 1) a new row on table Address (autoincrement) transaction 2) a new row on table Entreprise with a foreign key on table Addres; the new Entreprise inserted is linked to the new Adress #ID. End of Global transaction MYSQL dead-locks for this case with ResourceLocal / JPATransactionManager. Actually, it seems that we cannot open several nested transactions.

The global transaction seems to be merged with transactions 1) and 2). Transaction 2) ends in deadlock because data cannot be feeded with table A new #Id that is not ready. However, we can see with the debugger the new adresse row#id between transaction 1 and 2.Is it similar to your issue?

Do you guess some autoincrement - relation with your deadlock? These followings are possible solutions... Solution1 Change isolation level? -> How?!

I don't have the answer...And I'm not shure this will change anything. Solution2 Replace JPA Entities ID generation strategy (auto or identity) into a custom sequence table. Solution3 Check if you cannot use cascade strategy on ManyToOne relationships.

EntrepriseEntity{ @Id @GeneratedValue(strategy=GenerationType. IDENTITY) @Column(name = "id_entreprise") private int id; @ManyToOne(fetch=FetchType. LAZY,cascade=CascadeType.

ALL) @JoinColumn(name = "id_address") private AddressEntity address; And then save both rows into a single merge() : EntrepriseEntity e=new EntrepriseEntity(); e. SetAddress(new AddressEntity()); e=entityManager. Merge(e); Returned instance with give you back both new #ids inserted, and magic : no longer deadlock... Solution#3 is smarter, but needs deeper analysis and change some code...

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions