Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.5k views
in Technique[技术] by (71.8m points)

java - Hibernate: getting error to run this SQL query "alter session enable parallel dml" in Hibernate 5.4.x version

I have upgraded Hibernate 4.x version to Hibernate 5.4.x version in my application.

I am getting below error while running below SQL query:

javax.persistence.TransactionRequiredException: Executing an update/delete query at org.hibernate.internal.AbstractSharedSessionContract.checkTransactionNeededForUpdateOperation(AbstractSharedSessionContract.java:413) at org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(AbstractProducedQuery.java:1668)

SQL query:

hibernateSession.createSQLQuery("alter session enable parallel dml").executeUpdate();

Also failing the parallel running delete query after failing of above dml query.

I have tried using the @Transactional annotation (import org.springframework.transaction.annotation.Transactional;) on method level and class level but that didnt resolve my issue.

Any suggestion to resolve this error will be highly appreciable.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Looks like your transaction manager integration doesn't work properly then as Hibernate can't join the transaction. Not sure how your Spring configuration looks like, but there must be an issue with that. I guess you also updated Spring? Maybe you are using a now unsupported configuration?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...