Anonymous
Hibernate 4 Connection.autocommit=false игнорируется
Сообщение
Anonymous » 31 мар 2024, 15:06
У нас есть приложение, использующее Java, hibernate 4, guice 3, guice-persist 3 на tomcat 6
connection.autocommit настроен на false в hibernate.cfg Файл .xml:
Код: Выделить всё
org.hibernate.dialect.MySQL5InnoDBDialect
com.mysql.jdbc.Driver
jdbc:mysql://localhost:3306/dev
root
root
false
true
org.hibernate.cache.NoCacheProvider
false
false
3
true
true
true
create
thread
0
1
32
100
0
600
Но при развертывании файл журнала показывает, что для параметра autocommit установлено значение true:
Код: Выделить всё
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
28 janv. 2013 16:03:01 org.hibernate.annotations.common.Version
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
28 janv. 2013 16:03:01 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.9.Final}
28 janv. 2013 16:03:01 org.hibernate.cfg.Environment
INFO: HHH000206: hibernate.properties not found
28 janv. 2013 16:03:01 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
28 janv. 2013 16:03:01 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
28 janv. 2013 16:03:01 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
28 janv. 2013 16:03:01 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
28 janv. 2013 16:03:01 org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator instantiateExplicitConnectionProvider
INFO: HHH000130: Instantiating explicit connection provider: org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider
28 janv. 2013 16:03:01 org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure
INFO: HHH010002: C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/dev
28 janv. 2013 16:03:01 org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure
INFO: HHH000046: Connection properties: {user=root, password=****, autocommit=true, proof_property=true, release_mode=auto}
28 janv. 2013 16:03:01 org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure
INFO: HHH000006: Autocommit mode: true
28 janv. 2013 16:03:01 com.mchange.v2.log.MLog
INFO: MLog clients using java 1.4+ standard logging.
28 janv. 2013 16:03:02 com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.1 [built 16-January-2007 14:46:42; debug? true; trace: 10]
28 janv. 2013 16:03:02 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@b6868296 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@8d0e5680 [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hgeby98szzd5hkbs91s5|a69b6b, idleConnectionTestPeriod -> 0, initialPoolSize -> 0, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 600, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 32, maxStatements -> 100, maxStatementsPerConnection -> 0, minPoolSize -> 0, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@d4b5ff9b [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1hgeby98szzd5hkbs91s5|75b3ee, jdbcUrl -> jdbc:mysql://localhost:3306/dev, properties -> {user=******, password=******, autocommit=true, proof_property=true, release_mode=auto} ], preferredTestQuery -> null, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 1hgeby98szzd5hkbs91s5|1a9bea3, numHelperThreads -> 3 ]
28 janv. 2013 16:03:02 org.hibernate.dialect.Dialect
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
28 janv. 2013 16:03:02 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
28 janv. 2013 16:03:02 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory
28 janv. 2013 16:03:02 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory
INFO: HHH000397: Using ASTQueryTranslatorFactory
28 janv. 2013 16:03:02 org.hibernate.tool.hbm2ddl.SchemaExport execute
INFO: HHH000227: Running hbm2ddl schema export
Почему спящий режим игнорирует свойство autocommit? И должно ли нас это волновать? (поскольку наши тесты показали, что исключение в правильно аннотированном методе выполняет откат, поэтому все выглядит нормально)
Подробнее здесь:
https://stackoverflow.com/questions/145 ... se-ignored
1711886795
Anonymous
У нас есть приложение, использующее Java, hibernate 4, guice 3, guice-persist 3 на tomcat 6 connection.autocommit настроен на false в hibernate.cfg Файл .xml: [code] org.hibernate.dialect.MySQL5InnoDBDialect com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/dev root root false true org.hibernate.cache.NoCacheProvider false false 3 true true true create thread 0 1 32 100 0 600 [/code] Но при развертывании файл журнала показывает, что для параметра autocommit установлено значение true: [code]INFO: Starting Servlet Engine: Apache Tomcat/6.0.35 28 janv. 2013 16:03:01 org.hibernate.annotations.common.Version INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final} 28 janv. 2013 16:03:01 org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.1.9.Final} 28 janv. 2013 16:03:01 org.hibernate.cfg.Environment INFO: HHH000206: hibernate.properties not found 28 janv. 2013 16:03:01 org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist 28 janv. 2013 16:03:01 org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml 28 janv. 2013 16:03:01 org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: /hibernate.cfg.xml 28 janv. 2013 16:03:01 org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null 28 janv. 2013 16:03:01 org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator instantiateExplicitConnectionProvider INFO: HHH000130: Instantiating explicit connection provider: org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider 28 janv. 2013 16:03:01 org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure INFO: HHH010002: C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/dev 28 janv. 2013 16:03:01 org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure INFO: HHH000046: Connection properties: {user=root, password=****, autocommit=true, proof_property=true, release_mode=auto} 28 janv. 2013 16:03:01 org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure INFO: HHH000006: Autocommit mode: true 28 janv. 2013 16:03:01 com.mchange.v2.log.MLog INFO: MLog clients using java 1.4+ standard logging. 28 janv. 2013 16:03:02 com.mchange.v2.c3p0.C3P0Registry banner INFO: Initializing c3p0-0.9.1 [built 16-January-2007 14:46:42; debug? true; trace: 10] 28 janv. 2013 16:03:02 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@b6868296 [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@8d0e5680 [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hgeby98szzd5hkbs91s5|a69b6b, idleConnectionTestPeriod -> 0, initialPoolSize -> 0, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 600, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 32, maxStatements -> 100, maxStatementsPerConnection -> 0, minPoolSize -> 0, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@d4b5ff9b [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1hgeby98szzd5hkbs91s5|75b3ee, jdbcUrl -> jdbc:mysql://localhost:3306/dev, properties -> {user=******, password=******, autocommit=true, proof_property=true, release_mode=auto} ], preferredTestQuery -> null, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 1hgeby98szzd5hkbs91s5|1a9bea3, numHelperThreads -> 3 ] 28 janv. 2013 16:03:02 org.hibernate.dialect.Dialect INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect 28 janv. 2013 16:03:02 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException 28 janv. 2013 16:03:02 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService INFO: HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory 28 janv. 2013 16:03:02 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory INFO: HHH000397: Using ASTQueryTranslatorFactory 28 janv. 2013 16:03:02 org.hibernate.tool.hbm2ddl.SchemaExport execute INFO: HHH000227: Running hbm2ddl schema export [/code] Почему спящий режим игнорирует свойство autocommit? И должно ли нас это волновать? (поскольку наши тесты показали, что исключение в правильно аннотированном методе выполняет откат, поэтому все выглядит нормально) Подробнее здесь: [url]https://stackoverflow.com/questions/14564961/hibernate-4-connection-autocommit-false-ignored[/url]