[Hibernate-JIRA] Created: (HHH-6425) On Sybase ASE, insert a empty string '' to db, it stores it as single space ' '
by Ren Junyan (JIRA)
On Sybase ASE, insert a empty string '' to db, it stores it as single space ' '
-------------------------------------------------------------------------------
Key: HHH-6425
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6425
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.0
Environment: Hibernate 3.6.6, Sybase ASE15.5, JDK 1.6, Windows XP
Reporter: Ren Junyan
This is a defect of ASE, it fails the test below.
testNewSerializableType(org.hibernate.test.lob.SerializableTypeTest)
org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.util.SerializationHelper.doDeserialize(SerializationHelper.java:250)
at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:306)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:130)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:116)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:39)
at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:62)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:249)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:229)
at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:330)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1527)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1455)
at org.hibernate.loader.Loader.getRow(Loader.java:1355)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:611)
at org.hibernate.loader.Loader.doQuery(Loader.java:829)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3293)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1005)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:998)
at org.hibernate.test.lob.SerializableTypeTest.testNewSerializableType(SerializableTypeTest.java:82)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2280)
at java.io.ObjectInputStream$BlockDataInputStream.readUnsignedShort(ObjectInputStream.java:2761)
at java.io.ObjectInputStream$BlockDataInputStream.readUTF(ObjectInputStream.java:2819)
at java.io.ObjectInputStream.readString(ObjectInputStream.java:1598)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at org.hibernate.util.SerializationHelper.doDeserialize(SerializationHelper.java:244)
... 60 more
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 4 months
[Hibernate-JIRA] Commented: (HHH-1523) Rebuild fetches from query-cache hits
by Julien Kronegg (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1523?page=c... ]
Julien Kronegg commented on HHH-1523:
-------------------------------------
[SOLVED] I followed the code modification proposed by [Titi|https://hibernate.onjira.com/browse/HHH-1523?focusedCommentId=38668&...] and made the following ones (for Hibernate 3.3.1) :
# create a {{mypackage.CustomCacheLoadEventListener}} class extending {{org.hibernate.event.def.DefaultLoadEventListener}}
# override the {{proxyOrLoad()}}, {{createProxyIfNecessary()}} and {{returnNarrowedProxy()}} methods with the same code as in the parent class
# modify the {{createProxyIfNecessary()}} method as proposed by Titi, i.e. changing from
{code}
log.trace( "creating new proxy for entity" );
// return new uninitialized proxy
Object proxy = persister.createProxy( event.getEntityId(), event.getSession() );
persistenceContext.getBatchFetchQueue().addBatchLoadableEntityKey(keyToLoad);
persistenceContext.addProxy(keyToLoad, proxy);
return proxy;
{code}
to
{code}
final Object cached = loadFromSecondLevelCache(event, persister, options);
if (cached != null) {
// found in L2 cache => return it
return cached;
} else {
// not found in L2 cache => return a proxy
log.trace("creating new proxy for entity");
// return new uninitialized proxy
final Object proxy = persister.createProxy(event.getEntityId(), event.getSession());
persistenceContext.getBatchFetchQueue().addBatchLoadableEntityKey(keyToLoad);
persistenceContext.addProxy(keyToLoad, proxy);
return proxy;
}
{code}
# in the {{persistence.xml}}, add the following property:
{code}
<property name="hibernate.ejb.event.load" value="mypackage.CustomCacheLoadEventListener"/>
{code}
That's all!
Now, if I execute the test case from my previous post, I get no {{LazyInitializationException}}, which is the expected result.
Thanks a lot Titi!
> Rebuild fetches from query-cache hits
> -------------------------------------
>
> Key: HHH-1523
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1523
> Project: Hibernate Core
> Issue Type: New Feature
> Components: caching (L2), core, query-criteria, query-hql, query-sql
> Affects Versions: 3.0.5, 3.1
> Reporter: Vikas Sasidharan
> Attachments: cache_issue.log, QueryCacheIssue.zip
>
>
> I have two domain objects - Employee and Department - and there is a 1:N relationship from Department to Employee. When I join fetch an Employee with its Department, without query cache enabled, it works fine. If I enable query cache for this same query, it bombs with a LazyInitializationException.
> Notes:
> 1) We get this error only if query cache is enabled.
> 2) We observed the same behaviour on both oscache and ehcache
> 3) Calling Hibernate.initialize() explicitly after firing the HQL seems to work. The initialization does not fire an extra query though (it seems to pick it from the cache).
> 4) Setting "lazy=false" on the "many-to-one" mapping also works. However, it wouldn't be acceptable.
> Hibernate version: 3.0.5
> Mapping documents:
> Employee.hbm.xml
> <hibernate-mapping>
> <class name="tavant.platform.test.domain.Employee"
> table="CACHE_ISSUE_EMP" lazy="true" dynamic-update="true" dynamic-insert="true">
> <cache usage="read-write" />
> <id name="id" column="EMP_ID" type="java.lang.Long"
> access="field" unsaved-value="null">
> <generator class="increment" />
> </id>
>
> <property name="name" type="string" update="true"
> insert="true" column="EMP_NAME"/>
> <many-to-one name="department" class="tavant.platform.test.domain.Department"
> cascade="none" outer-join="auto" update="true" insert="true" column="DEPARTMENT_ID"/>
> </class>
> </hibernate-mapping>
>
> Department.hbm.xml
> <hibernate-mapping>
> <class name="tavant.platform.test.domain.Department" table="CACHE_ISSUE_DEP"
> lazy="true" dynamic-update="true" dynamic-insert="true">
>
> <cache usage="read-write" />
> <id name="id" column="DEPARTMENT_ID"
> type="java.lang.Long" access="field">
> <generator class="increment"/>
> </id>
> <property name="name" type="java.lang.String"
> update="false" insert="true" column="NAME"/>
> <bag name="employees" lazy="true"
> inverse="true" cascade="save-update" access="field">
> <cache usage="read-write"/>
> <key column="DEPARTMENT_ID"/>
> <one-to-many class="tavant.platform.test.domain.Employee"/>
> </bag>
> </class>
> </hibernate-mapping>
>
> Code between sessionFactory.openSession() and session.close():
> public Employee getEmployeeWithDepartment(String empName) {
> Session session = null;
> try {
> session = sessionFactory.openSession();
> Employee emp = (Employee) session.createQuery(
> "from Employee e join fetch e.department where e.name = :name")
> .setString("name", empName)
> .setCacheable(true)
> .uniqueResult();
> // If I uncomment the next line, this works (even without
> // firing an extra query)!
> // Hibernate.initialize(emp.getDepartment());
> return emp;
> } finally {
> if (session != null) {
> session.close();
> }
> }
> }
>
> // First load employee and populate cahces
> Employee emp = test.getEmployeeWithDepartment(EMPLOYEE_NAME);
> System.out.println("Employee : " + emp + ", Employee.Department : "
> + emp.getDepartment());
>
> // Now try to make use of the cache
> emp = test.getEmployeeWithDepartment(EMPLOYEE_NAME);
> System.out.println("Employee : " + emp + ", Employee.Department : "
> + emp.getDepartment());
>
> Full stack trace of any exception that occurs:
> org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
> at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
> at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
> at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
> at tavant.platform.test.domain.Department$$EnhancerByCGLIB$$67b26899.toString(<generated>)
> at java.lang.String.valueOf(String.java:2131)
> at java.lang.StringBuffer.append(StringBuffer.java:370)
> at tavant.platform.test.client.TestPrefetchRelationWithQueryCacheEnabled.main(TestPrefetchRelationWithQueryCacheEnabled.java:116)
>
> Name and version of the database you are using:
> We have noticed this on Oracle and HSQL
> The generated SQL (show_sql=true):
> #First read, goes fine
> Hibernate: select employee0_.EMP_ID as EMP1_0_, department1_.DEPARTMENT_ID as DEPARTMENT1_1_, employee0_.EMP_NAME as EMP2_1_0_, employee0_.DEPARTMENT_ID as DEPARTMENT3_1_0_, department1_.NAME as NAME0_1_ from CACHE_ISSUE_EMP employee0_ inner join CACHE_ISSUE_DEP department1_ on employee0_.DEPARTMENT_ID=department1_.DEPARTMENT_ID where (employee0_.EMP_NAME=? )
> #Prints the Employee and Department fine
> Employee : [Id : 1, name : testEmployee], Employee.Department : [Id : 1, name : testDepartment]
> #Second read bombs!
> org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
> at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
> at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
> at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
> [..]
> Please have a look at the post [http://forum.hibernate.org/viewtopic.php?t=955839] for more details and follow ups.
> Kindly help. I am attaching an Eclipse Project containing the TestCase. The main file is TestPrefetchRelationWithQueryCacheEnabled.
> Thanks,
> Vikas
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1523) Rebuild fetches from query-cache hits
by Julien Kronegg (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1523?page=c... ]
Julien Kronegg commented on HHH-1523:
-------------------------------------
BTW, you get the same error when doing the following HQL query twice and access to the resulting list with a closed entity manager on Hibernate 3.3.1:
{code}
SELECT emp.department FROM Employee emp
{code}
Note that the generated SQL has an INNER JOIN as in the original issue description where the HQL has a JOIN FETCH:
{code}
Hibernate: select employee0_.EMP_ID as EMP1_0_, department1_.DEPARTMENT_ID as DEPARTMENT1_1_, employee0_.EMP_NAME as EMP2_1_0_, employee0_.DEPARTMENT_ID as DEPARTMENT3_1_0_, department1_.NAME as NAME0_1_ from CACHE_ISSUE_EMP employee0_ inner join CACHE_ISSUE_DEP department1_ on employee0_.DEPARTMENT_ID=department1_.DEPARTMENT_ID
{code}
The full pseudo-code is:
{code}
// step 1
EntityManager em = ... // build an EM from the EMF
Query q = em.createQuery("SELECT emp.department FROM Employee emp");
... // enable query cache for q
List<Department> list = q.getResultList();
em.close();
list.iterator().next().getId(); // no LIE raised here (expected result)
// step 2
EntityManager em = ... // build an EM from the EMF
Query q = em.createQuery("SELECT emp.department FROM Employee emp");
... // enable query cache for q
List<Department> list = q.getResultList();
em.close();
list.iterator().next().getId(); // LIE raised here!!! (unexpected result)
{code}
Steve: you may consider that behavior as a feature, but you should admit that it is not very practical to ask yourself the question whether or not the generated SQL contains an INNER JOIN. And if so, you should take care of the query cache result...
> Rebuild fetches from query-cache hits
> -------------------------------------
>
> Key: HHH-1523
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1523
> Project: Hibernate Core
> Issue Type: New Feature
> Components: caching (L2), core, query-criteria, query-hql, query-sql
> Affects Versions: 3.0.5, 3.1
> Reporter: Vikas Sasidharan
> Attachments: cache_issue.log, QueryCacheIssue.zip
>
>
> I have two domain objects - Employee and Department - and there is a 1:N relationship from Department to Employee. When I join fetch an Employee with its Department, without query cache enabled, it works fine. If I enable query cache for this same query, it bombs with a LazyInitializationException.
> Notes:
> 1) We get this error only if query cache is enabled.
> 2) We observed the same behaviour on both oscache and ehcache
> 3) Calling Hibernate.initialize() explicitly after firing the HQL seems to work. The initialization does not fire an extra query though (it seems to pick it from the cache).
> 4) Setting "lazy=false" on the "many-to-one" mapping also works. However, it wouldn't be acceptable.
> Hibernate version: 3.0.5
> Mapping documents:
> Employee.hbm.xml
> <hibernate-mapping>
> <class name="tavant.platform.test.domain.Employee"
> table="CACHE_ISSUE_EMP" lazy="true" dynamic-update="true" dynamic-insert="true">
> <cache usage="read-write" />
> <id name="id" column="EMP_ID" type="java.lang.Long"
> access="field" unsaved-value="null">
> <generator class="increment" />
> </id>
>
> <property name="name" type="string" update="true"
> insert="true" column="EMP_NAME"/>
> <many-to-one name="department" class="tavant.platform.test.domain.Department"
> cascade="none" outer-join="auto" update="true" insert="true" column="DEPARTMENT_ID"/>
> </class>
> </hibernate-mapping>
>
> Department.hbm.xml
> <hibernate-mapping>
> <class name="tavant.platform.test.domain.Department" table="CACHE_ISSUE_DEP"
> lazy="true" dynamic-update="true" dynamic-insert="true">
>
> <cache usage="read-write" />
> <id name="id" column="DEPARTMENT_ID"
> type="java.lang.Long" access="field">
> <generator class="increment"/>
> </id>
> <property name="name" type="java.lang.String"
> update="false" insert="true" column="NAME"/>
> <bag name="employees" lazy="true"
> inverse="true" cascade="save-update" access="field">
> <cache usage="read-write"/>
> <key column="DEPARTMENT_ID"/>
> <one-to-many class="tavant.platform.test.domain.Employee"/>
> </bag>
> </class>
> </hibernate-mapping>
>
> Code between sessionFactory.openSession() and session.close():
> public Employee getEmployeeWithDepartment(String empName) {
> Session session = null;
> try {
> session = sessionFactory.openSession();
> Employee emp = (Employee) session.createQuery(
> "from Employee e join fetch e.department where e.name = :name")
> .setString("name", empName)
> .setCacheable(true)
> .uniqueResult();
> // If I uncomment the next line, this works (even without
> // firing an extra query)!
> // Hibernate.initialize(emp.getDepartment());
> return emp;
> } finally {
> if (session != null) {
> session.close();
> }
> }
> }
>
> // First load employee and populate cahces
> Employee emp = test.getEmployeeWithDepartment(EMPLOYEE_NAME);
> System.out.println("Employee : " + emp + ", Employee.Department : "
> + emp.getDepartment());
>
> // Now try to make use of the cache
> emp = test.getEmployeeWithDepartment(EMPLOYEE_NAME);
> System.out.println("Employee : " + emp + ", Employee.Department : "
> + emp.getDepartment());
>
> Full stack trace of any exception that occurs:
> org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
> at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
> at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
> at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
> at tavant.platform.test.domain.Department$$EnhancerByCGLIB$$67b26899.toString(<generated>)
> at java.lang.String.valueOf(String.java:2131)
> at java.lang.StringBuffer.append(StringBuffer.java:370)
> at tavant.platform.test.client.TestPrefetchRelationWithQueryCacheEnabled.main(TestPrefetchRelationWithQueryCacheEnabled.java:116)
>
> Name and version of the database you are using:
> We have noticed this on Oracle and HSQL
> The generated SQL (show_sql=true):
> #First read, goes fine
> Hibernate: select employee0_.EMP_ID as EMP1_0_, department1_.DEPARTMENT_ID as DEPARTMENT1_1_, employee0_.EMP_NAME as EMP2_1_0_, employee0_.DEPARTMENT_ID as DEPARTMENT3_1_0_, department1_.NAME as NAME0_1_ from CACHE_ISSUE_EMP employee0_ inner join CACHE_ISSUE_DEP department1_ on employee0_.DEPARTMENT_ID=department1_.DEPARTMENT_ID where (employee0_.EMP_NAME=? )
> #Prints the Employee and Department fine
> Employee : [Id : 1, name : testEmployee], Employee.Department : [Id : 1, name : testDepartment]
> #Second read bombs!
> org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
> at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:53)
> at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:84)
> at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:134)
> [..]
> Please have a look at the post [http://forum.hibernate.org/viewtopic.php?t=955839] for more details and follow ups.
> Kindly help. I am attaching an Eclipse Project containing the TestCase. The main file is TestPrefetchRelationWithQueryCacheEnabled.
> Thanks,
> Vikas
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[Hibernate-JIRA] Created: (HSEARCH-961) ObjectNotFoundException not caught in FullTextSession for deleted objects
by Anders Soee (JIRA)
ObjectNotFoundException not caught in FullTextSession for deleted objects
-------------------------------------------------------------------------
Key: HSEARCH-961
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-961
Project: Hibernate Search
Issue Type: Bug
Components: query
Affects Versions: 3.4.1.Final
Environment: Hibernate 3.6.7
EHCache 1.2.4 and 2.4.6 in Read-write mode.
MS SQL Server 2000
async indexing.
Reporter: Anders Soee
Priority: Minor
Experienced behavior:
1: Show page with search results.
2: Delete one
3: Redirect back to the previous search.
4: Sometimes (about 1 in 10), the search fails with an ObjecNotFoundException.
Expected behavior:
As experienced, minus the exceptions.
My analysis:
Since the indexing is asynchronous, there will be a short period, where the search will include the deleted item.
If the entities where not cached, this should not be a problem, since they would simply not be included in the IN query.
In this case, however, all the entities are cached by EHCache in read-write mode.
I have identified the problem to be in SecondLevelCacheObjectsInitializer:
65: final boolean isIn2LCache = session.getSessionFactory().getCache().containsEntity( entityInfo.getClazz(), entityInfo.getId() );
66: if ( isIn2LCache ) {
67: //load the object from the second level cache
68: session.get( entityInfo.getClazz(), entityInfo.getId() );
69: }
Line 68 is where the exception occurs.
It appears that cache.containsEntity() is not a guarantee that the entity can actually be loaded.
In fact, in EHCache a lock object is placed in the cache when the item is deleted, and never removed again.
Thus the cache contains "something", just not a loadable entity.
My suggestion:
Wrap session.get() with a try-catch block, and ignore ObjectNotFoundException's (and probably EntityNotFoundException too, for JPA).
My workaround:
Manually evicting the entity from the 2nd level cache when deleting it.
Stacktrace:
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.jysk.resmgr.model.Resource#5663]
at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:435)
at org.hibernate.event.def.DefaultLoadEventListener.returnNarrowedProxy(DefaultLoadEventListener.java:320)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:277)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1005)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:998)
at org.hibernate.search.query.hibernate.impl.SecondLevelCacheObjectsInitializer.initializeObjects(SecondLevelCacheObjectsInitializer.java:68)
at org.hibernate.search.query.hibernate.impl.PersistenceContextObjectsInitializer.initializeObjects(PersistenceContextObjectsInitializer.java:81)
at org.hibernate.search.query.hibernate.impl.MultiClassesQueryLoader.executeLoad(MultiClassesQueryLoader.java:135)
at org.hibernate.search.query.hibernate.impl.AbstractLoader.load(AbstractLoader.java:72)
at org.hibernate.search.query.hibernate.impl.FullTextQueryImpl.list(FullTextQueryImpl.java:208)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1123) Cannot put more than 1000 elements in a InExpression
by Strong Liu (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1123?page=c... ]
Strong Liu commented on HHH-1123:
---------------------------------
could someone help on this and create a pull request?
we're on a extremely busy period :(
> Cannot put more than 1000 elements in a InExpression
> ----------------------------------------------------
>
> Key: HHH-1123
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1123
> Project: Hibernate Core
> Issue Type: Improvement
> Components: core
> Affects Versions: 3.1 rc2, 3.2.0.alpha1
> Environment: Oracle 9i
> Reporter: Alexis Seigneurin
> Assignee: Strong Liu
> Attachments: Animal.hbm.xml, hibernate-inexpression-oracle-3.2.patch, HQLHelper.java, LongInElementsTest.java, patch.txt
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> The number of elements that we can put in a "in" expression is limited to a certain amount (1000 for Oracle, for instance). When creating a criteria query, the org.hibernate.criterion.InExpression class should split the expression into several smaller ones.
> Attached is a patch which splits the expression by slices of 500 elements. For example, if we have 1001 elements to put in the "in" expression, the result would be :
> (entity.field in (?, ?, ?...) or entity.field in (?, ?, ?...) or entity.field in (?))
> The surrounding parantheses are useful to avoid problems with other conditions (a "and" condition taking over the one of the "or" conditions).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months