[Hibernate-JIRA] Created: (HHH-5704) New getSubString() handling in ClobProxy is incompatible with MySQL JDBC PS.setClob(int, Clob) for empty CLOB
by Sergey Vladimirov (JIRA)
New getSubString() handling in ClobProxy is incompatible with MySQL JDBC PS.setClob(int, Clob) for empty CLOB
-------------------------------------------------------------------------------------------------------------
Key: HHH-5704
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5704
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.0
Environment: MySQL JDBC 5.1.12 / 5.1.13
Reporter: Sergey Vladimirov
For all empty but not-null CLOBs MySQL drivers do the following (com.mysql.jdbc.PreparedStatement):
String forcedEncoding = this.connection.getClobCharacterEncoding();
if (forcedEncoding == null) {
setString(i, x.getSubString(1L, (int) x.length()));
} else {
try {
setBytes(i, x.getSubString(1L,
(int)x.length()).getBytes(forcedEncoding));
} catch (UnsupportedEncodingException uee) {
throw SQLError.createSQLException("Unsupported character encoding " +
forcedEncoding, SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
}
}
As you can see, getSubString is called with first argument (start) equal to 1, even if length of CLOB is 0. Of course, it's not very good, but it worked for previous versions of Hibernate. But in 3.6.0 getSubString() handling in ClobProxy introduces additional checks that prevents the code above from working:
if ( start > getLength() ) {
throw new SQLException( "Start position [" + start + "] cannot exceed overall CLOB length [" + getLength() + "]" );
}
Thus this code will now thrown an exception if content is empty (but not null!) CLOB. Here the part of stack trace:
31.10 16:46:03 .AbstractFlushingEventListener ERROR Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not insert: [ru.arptek.classes.dummy.Article$Content]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2436)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2856)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:795)
at ru.arptek.arpsite.content.WebObjectHome.create(WebObjectHome.java:122)
(...)
Caused by: java.sql.SQLException: Start position [1] cannot exceed overall CLOB length [0]
at org.hibernate.engine.jdbc.ClobProxy.invoke(ClobProxy.java:146)
at $Proxy52.getSubString(Unknown Source)
at com.mysql.jdbc.PreparedStatement.setClob(PreparedStatement.java:3542)
at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.setClob(PreparedStatementWrapper.java:299)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setClob(DelegatingPreparedStatement.java:187)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setClob(DelegatingPreparedStatement.java:187)
at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$1.doBind(ClobTypeDescriptor.java:60)
at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:89)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:282)
at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:277)
at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:85)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2166)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2412)
... 70 more
I believe there should be additional check like:
long start = (Long) args[0];
if ( start < 1 ) {
throw new SQLException( "Start position 1-based; must be 1 or more." );
}
int length = (Integer) args[1];
if ( length < 0 ) {
throw new SQLException( "Length must be great-than-or-equal to zero." );
}
// workaround for MySQL incompatibility
if ( start == 1 && length == 0) {
return "";
} else if ( start > getLength() ) {
throw new SQLException( "Start position [" + start + "] cannot exceed overall CLOB length [" + getLength() + "]" );
}
return getSubString( start-1, length );
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[Hibernate-JIRA] Created: (HHH-3826) Hibernate 3.3.1.GA + Javassist issue 3.9.0.GA : java.lang.RuntimeException: by java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy (OSGI Server)
by Charles Moulliard (JIRA)
Hibernate 3.3.1.GA + Javassist issue 3.9.0.GA : java.lang.RuntimeException: by java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy (OSGI Server)
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-3826
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3826
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.3.1
Reporter: Charles Moulliard
Hi,
I try to use Hibernate 3.3.1.GA in combination with Spring OSGI 1.2.0-rc1. Unfortunately, there is a classloading issue on OSGI :
{code}
Caused by: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:174)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxyFactory(JavassistLazyInitializer.java:162)
... 58 more
Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:167)
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:170)
... 59 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:159)
... 60 more
{code}
remark : the package org.hibernate.proxy is defined in the MANIFEST file (section - Import-PAckage)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[Hibernate-JIRA] Created: (HHH-4700) ClassCastException with parameter in CaseNode.getFirstThenNode()
by Jean-Baptiste Mille (JIRA)
ClassCastException with parameter in CaseNode.getFirstThenNode()
----------------------------------------------------------------
Key: HHH-4700
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4700
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.3.2, 3.3.1, 3.3.0.SP1, 3.3.0.GA, 3.3.0.CR2, 3.3.0.CR1, 3.2.7, 3.2.6, 3.2.5, 3.2.4.sp1, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2.0.ga, 3.2.0.cr5, 3.2.0.cr4, 3.2.0.cr3, 3.2.0.cr2, 3.2.0 cr1
Environment: Hibernate 3.3.2.ga
Reporter: Jean-Baptiste Mille
Priority: Minor
Attachments: testcase.zip
Hql query with CASE .. WHEN and parameter in THEN clause throws a classCastException.
Example :
{code}
UPDATE MyObject SET myProperty = CASE WHEN myFilterProperty like 'L%' THEN :new_value END
{code}
Exception
java.lang.ClassCastException: org.hibernate.hql.ast.tree.ParameterNode cannot be cast to org.hibernate.hql.ast.tree.SelectExpression
at org.hibernate.hql.ast.tree.CaseNode.getFirstThenNode(CaseNode.java:44)
at org.hibernate.hql.ast.tree.CaseNode.getDataType(CaseNode.java:40)
at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.extractDataType(BinaryLogicOperatorNode.java:210)
at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.initialize(BinaryLogicOperatorNode.java:58)
at org.hibernate.hql.ast.HqlSqlWalker.prepareLogicOperator(HqlSqlWalker.java:1133)
at org.hibernate.hql.ast.HqlSqlWalker.evaluateAssignment(HqlSqlWalker.java:1043)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.assignment(HqlSqlBaseWalker.java:1086)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.setClause(HqlSqlBaseWalker.java:766)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.updateStatement(HqlSqlBaseWalker.java:361)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:239)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at com.bnpparibas.eqd.DMLCaseTest.runQuery(DMLCaseTest.java:67)
at com.bnpparibas.eqd.DMLCaseTest.doesntWork(DMLCaseTest.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
This issue have been [posted in user forum|https://forum.hibernate.org/viewtopic.php?f=1&t=981196&p=2369061&hi...].
It works with Hibernate 3.1.3.
A test case (designed for Hibernate 3.3.2.ga) which illustrate this issue is attached.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[Hibernate-JIRA] Created: (HHH-4947) Silent exclusion of null-valued map entry
by Tsering Shrestha (JIRA)
Silent exclusion of null-valued map entry
-----------------------------------------
Key: HHH-4947
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4947
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-CR-1, 3.3.2
Reporter: Tsering Shrestha
<class name="Product">
<id name="id">
<generator class="native"/>
</id>
<map name="sellingPrice">
<key column="PRODUCT" not-null="true" foreign-key="FK_SP_PRODUCT"/>
<map-key type="string" column="model" not-null="true"/>
<element type="double" column="price" not-null="false"/>
</map>
</class>
Product product = new Product();
Product.getSellingPrice().put("XL",null);
Product.getSellingPrice().put("L", 34.90);
session.save(product)
Gives the following SQL:
insert into PRODUCT (id) values (null)
call identity()
insert into SELLINGPRICE (PRODUCT, MODEL, PRICE) values (?, ?, ?)
And the SELLINGPRICE table indeed only has one row. Why does Hibernately *silently* remove my null-valued entry? I would either want it to be able to save the entry or raise an exception that it cannot.
Report this post
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[Hibernate-JIRA] Created: (HHH-2031) Add functions to Dialect that can disable use of schema and catalog parts -- for HSQLDB support
by Brian Holmes (JIRA)
Add functions to Dialect that can disable use of schema and catalog parts -- for HSQLDB support
-----------------------------------------------------------------------------------------------
Key: HHH-2031
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2031
Project: Hibernate3
Type: Patch
Components: core
Versions: 3.1.3
Environment: This patch is against r9668 of /tags/v313/Hibernate3.
Reporter: Brian Holmes
Attachments: hibernate3-v313-support_schema_catalog_names.patch
HSQLDB does not support the use of three part names, that is Tables with schema and catalog parts.
This patch adds two functions to Dialect: supportsSchemaNames() and supportsCatalogNames(). Table.getQualifiedName() checks these values to decide whether to use or ignore the schema and catalog parts.
By default these are enabled in Dialect. This patch only disables their use in HSQLDialect.
This change is necessary for people who normally use Schema and Catalog names for access their primary database, but also use HSQLDB for Unit Testing. Without it, HSQLDB is unusable for Unit Testing because it fails on use of any catalog or schema names.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
11 years, 10 months
[Hibernate-JIRA] Created: (HHH-4607) Deleted entities incorrectly reloaded within persistence context due to 2L cache
by Guenther Demetz (JIRA)
Deleted entities incorrectly reloaded within persistence context due to 2L cache
--------------------------------------------------------------------------------
Key: HHH-4607
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4607
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.3.2
Environment: Hibernate3.3.2GA, SQLServer2008 used with COMMITED_READ isolation level
Reporter: Guenther Demetz
Attachments: TestCaseReloadAfterDelete.jar
Normally hibernate_session.get(entityName, id) returns null if the concerning entity is scheduled for removal, indipendently if the current context was already flushed or not, and this is also correct.
Attached testcase indeed shows, that with active 2Lcache
hibernate_session.get(entityName, id) suddenly and incorrectly returns the concerning entity again
if the deletion is already flushed and if in meantime another concurrent session do load the entity
(possible with COMMITED_READ isolation)!
Please see the attached testcase for detailed informations.
Here the output of the testcase:
15:37:30,417 INFO Version:15 - Hibernate Annotations 3.4.0.GA
15:37:30,446 INFO Environment:560 - Hibernate 3.3.2.GA
15:37:30,452 INFO Environment:593 - hibernate.properties not found
15:37:30,461 INFO Environment:771 - Bytecode provider name : javassist
15:37:30,470 INFO Environment:652 - using JDK 1.4 java.sql.Timestamp handling
15:37:30,580 INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA
15:37:30,587 INFO Version:16 - Hibernate EntityManager 3.4.0.CR1
15:37:30,993 INFO AnnotationBinder:419 - Binding entity from annotated class: hello.Customer$Passport
15:37:31,048 INFO EntityBinder:422 - Bind entity hello.Customer$Passport on table Customer$Passport
15:37:31,141 INFO AnnotationBinder:419 - Binding entity from annotated class: hello.Customer
15:37:31,143 INFO EntityBinder:422 - Bind entity hello.Customer on table Customer
15:37:31,191 INFO AnnotationBinder:419 - Binding entity from annotated class: hello.A
15:37:31,193 INFO EntityBinder:422 - Bind entity hello.A on table A
15:37:31,206 INFO AnnotationBinder:419 - Binding entity from annotated class: hello.Messag
15:37:31,207 INFO EntityBinder:422 - Bind entity hello.Messag on table MESSAG
15:37:31,221 INFO AnnotationBinder:419 - Binding entity from annotated class: hello.SMS
15:37:31,224 INFO EntityBinder:422 - Bind entity hello.SMS on table SMS
15:37:31,240 INFO AnnotationBinder:419 - Binding entity from annotated class: hello.C
15:37:31,241 INFO EntityBinder:422 - Bind entity hello.C on table C
15:37:31,252 INFO AnnotationBinder:419 - Binding entity from annotated class: hello.B
15:37:31,254 INFO EntityBinder:422 - Bind entity hello.B on table B
15:37:31,257 INFO AnnotationBinder:419 - Binding entity from annotated class: hello.Amme
15:37:31,258 INFO EntityBinder:422 - Bind entity hello.Amme on table Amme
15:37:31,262 INFO AnnotationBinder:419 - Binding entity from annotated class: hello.Footballer
15:37:31,263 INFO EntityBinder:422 - Bind entity hello.Footballer on table Footballer
15:37:31,360 INFO CollectionBinder:650 - Mapping collection: hello.C.aggC -> C
15:37:31,370 INFO Version:17 - Hibernate Validator 3.1.0.GA
15:37:31,443 INFO HibernateSearchEventListenerRegister:53 - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
15:37:31,503 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
15:37:31,504 INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 20
15:37:31,505 INFO DriverManagerConnectionProvider:68 - autocommit mode: true
15:37:31,506 INFO DriverManagerConnectionProvider:72 - JDBC isolation level: READ_COMMITTED
15:37:31,658 INFO DriverManagerConnectionProvider:103 - using driver: com.microsoft.sqlserver.jdbc.SQLServerDriver at URL: jdbc:sqlserver://phx00081:1433;databasename=jpaexample
15:37:31,660 INFO DriverManagerConnectionProvider:109 - connection properties: {user=sa, password=****, autocommit=true, release_mode=auto}
15:37:32,305 INFO SettingsFactory:114 - RDBMS: Microsoft SQL Server, version: 10.00.1600
15:37:32,314 INFO SettingsFactory:115 - JDBC driver: Microsoft SQL Server JDBC Driver 2.0, version: 2.0.1803.100
15:37:32,353 INFO Dialect:175 - Using dialect: org.hibernate.dialect.SQLServerDialect
15:37:32,365 INFO TransactionFactoryFactory:62 - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
15:37:32,367 INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
15:37:32,367 INFO SettingsFactory:161 - Automatic flush during beforeCompletion(): disabled
15:37:32,368 INFO SettingsFactory:165 - Automatic session close at end of transaction: disabled
15:37:32,369 INFO SettingsFactory:180 - Scrollable result sets: enabled
15:37:32,370 INFO SettingsFactory:188 - JDBC3 getGeneratedKeys(): enabled
15:37:32,370 INFO SettingsFactory:196 - Connection release mode: auto
15:37:32,376 INFO SettingsFactory:223 - Default batch fetch size: 1
15:37:32,379 INFO SettingsFactory:227 - Generate SQL with comments: disabled
15:37:32,379 INFO SettingsFactory:231 - Order SQL updates by primary key: disabled
15:37:32,380 INFO SettingsFactory:235 - Order SQL inserts for batching: disabled
15:37:32,380 INFO SettingsFactory:397 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
15:37:32,384 INFO ASTQueryTranslatorFactory:47 - Using ASTQueryTranslatorFactory
15:37:32,385 INFO SettingsFactory:243 - Query language substitutions: {}
15:37:32,385 INFO SettingsFactory:248 - JPA-QL strict compliance: enabled
15:37:32,385 INFO SettingsFactory:253 - Second-level cache: enabled
15:37:32,386 INFO SettingsFactory:257 - Query cache: disabled
15:37:32,391 INFO SettingsFactory:382 - Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
15:37:32,392 INFO RegionFactoryCacheProviderBridge:61 - Cache provider: org.hibernate.cache.EhCacheProvider
15:37:32,398 INFO SettingsFactory:267 - Optimize cache for minimal puts: disabled
15:37:32,398 INFO SettingsFactory:276 - Structured second-level cache entries: disabled
15:37:32,404 INFO SettingsFactory:305 - Statistics: disabled
15:37:32,404 INFO SettingsFactory:309 - Deleted entity synthetic identifier rollback: disabled
15:37:32,405 INFO SettingsFactory:324 - Default entity-mode: pojo
15:37:32,405 INFO SettingsFactory:328 - Named query checking : enabled
15:37:32,474 INFO SessionFactoryImpl:193 - building session factory
15:37:32,496 WARN ConfigurationFactory:127 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/home/pb00067/hibernate-distribution-3.3.2.GA/lib/optional/ehcache/ehcache-1.2.3.jar!/ehcache-failsafe.xml
15:37:32,552 WARN EhCacheProvider:93 - Could not find configuration [hello.A]; using defaults.
15:37:32,719 INFO PojoInstantiator:84 - no default (no-argument) constructor for class: hello.Customer$Passport (class must be instantiated by Interceptor)
15:37:32,841 INFO SessionFactoryObjectFactory:105 - Not binding factory to JNDI, no JNDI name configured
15:37:32,875 INFO SchemaExport:226 - Running hbm2ddl schema export
15:37:32,877 INFO SchemaExport:251 - exporting generated schema to database
15:37:32,960 INFO SchemaExport:268 - schema export complete
The problem stays probably in method DefaultLoadEventListener#doLoad:
as the delete-action is already flushed, the concerning entity is not present in the sessioncache
anymore, where it was previously marked as REMOVED
DefaultLoadEventListener#doLoad:
...
Object entity = loadFromSessionCache( event, keyToLoad, options );
if ( entity == REMOVED_ENTITY_MARKER ) {
log.debug( "load request found matching entity in context, but it is scheduled for removal; returning null" );
return null;
}
...
entity = loadFromSecondLevelCache(event, persister, options);
if ( entity != null ) {
...
return entity;
}
Afterwards doLoad attempts to load the entity from SecondLevelCache,
where in meantime it may be put again due another concurrent session.
N.B.: I believe the problem arises too if I would use JTA using the same transaction manager
for both hibernate and 2LC (JBoss).
best regards
G.D.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[Hibernate-JIRA] Created: (HHH-3644) Add support for "WITH UR" isolation clause on DB2
by Ricardo Fernandes (JIRA)
Add support for "WITH UR" isolation clause on DB2
-------------------------------------------------
Key: HHH-3644
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3644
Project: Hibernate Core
Issue Type: Sub-task
Components: core
Affects Versions: 3.3.1
Environment: HIbernate 3.3.1 / DB2 9.x
Reporter: Ricardo Fernandes
The question is basically the same as Steve's, i.e. to force DB2 to use as few locks as possible on heavy load scenarios.
Although some might consider the use of the WITH UR clause a bad approach (since it allows dirty reads), the fact is that there are some cases where this is in fact acceptable, such as computing the total amount of rows of a query (for information purposes) or producing a high-level listing of items with very little detailed info. The bottom line is: if I need to trade performance for extremely accurate data, I surely want to be able to decide when this should happen.
I've already performed the changes that makes it possible to use both the FOR READ ONLY and the WITH UR clauses and I will be submitting a patch shortly so you can have a look at it. The strategy I've used was basically the following:
1. Added two new methods on the Dialect class:
String getDatabaseReadOnlyString(String sql) - for adding the READ ONLY clause
String getDirtyReadsString(String sql) - for adding the WITH UR clause
2. Changed the Query interface in order to allow the user to say whether he/she wants the query to allow dirty reads:
Query setAllowDirtyReads(boolean allowDirtyReads);
3. Added a default implementation on the AbstractQueryImpl which initializes the flag a false
4. Added a similar attribute on the QueryParameters class
5. Changed the prepareQueryStatement() method of the Loader class (just after the useLimit part in order:
a) Ask the dialect for the getDatabaseReadOnlyString() is there are no LockModes set (as did Steve)
b) Ask the dialect for the getDirtyReadsString() is the queyParameters allows dirty reads.
All the tests were well succeeded.
Hope you find these changes, at least, worth looking at.
Best Regards,
Ricardo
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months