Partial commit when Connection close in Oracle with Hibernate/JPA

自作多情 提交于 2019-12-13 03:44:13

问题


Recently got this following error in my application JPA/Hibernate with database Oracle RAC 11g.

This error occurred when our storage was full and DBA needed close connections, kill active sessions, or some like this "Connection closed" (now I can know what happened, he was fired....)

javax.persistence.RollbackException: Error while commiting the transaction
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71)
at com.cgmp.ValePedagioSite.comprarViagemPorPlaca(ValePedagioSite.java:473)
at sun.reflect.GeneratedMethodAccessor1719.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
        (...)
Caused by: org.hibernate.exception.JDBCConnectionException: could not insert: [com.cgmp.model.entity.PedagioPracaViagem]
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:97)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2295)
        (...)
Caused by: java.sql.SQLRecoverableException: Connection closed
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3331)
at oracle.jdbc.driver.T2CConnection.prepareStatement(T2CConnection.java:47)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3232)
at oracle.jdbc.driver.T2CConnection.prepareStatement(T2CConnection.java:47)
at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:213)
        (...)

Others entities was inserted without problem...

--- EDITED ---

More informations

Configuration c3p0

<Resource auth="Container"
description=""
driverClass="oracle.jdbc.driver.OracleDriver"
acquireIncrement="1"
initialPoolSize="5"
maxPoolSize="300"
minPoolSize="5"
maxIdleTime="600"
maxIdleTimeExcessConnections="300"
unreturnedConnectionTimeout="900"
numHelperThreads="20"
name=""
user=""
password=" "
factory="org.apache.naming.factory.BeanFactory"
type="com.mchange.v2.c3p0.ComboPooledDataSource"
jdbcUrl="jdbc:oracle:oci:" />

Talking with other DBA he said that one instance from Oracle got full disk, and the registers partial commiteds was created in this moment, but he just deleted trace files, didn't stop db and not killed any session.


回答1:


Well there is not enough information to say for certain, but it sounds like what you are seeing it non-completed transaction handling. The JDBC spec is silently on the issue of what should happen in the case of non-completed transactions. Oracle is the only vendor I know of that decided the best course of action was to commit the work in that situation.



来源:https://stackoverflow.com/questions/10825353/partial-commit-when-connection-close-in-oracle-with-hibernate-jpa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!