[Hibernate-JIRA] Created: (HSEARCH-374) Timeout support for lucene searches
by Benjamin Gniza (JIRA)
Timeout support for lucene searches
-----------------------------------
Key: HSEARCH-374
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-374
Project: Hibernate Search
Issue Type: New Feature
Components: query
Reporter: Benjamin Gniza
Attachments: bit-TimeoutPatched-Hibernate-Search-1.0.1EXPERIMENTAL.zip
It would be nice to add support for the TimeLimitedCollector of Lucene (Versions 2.4.0 and above).
We needed that feature in our project within a week so we couldn't wait for a new official release and had to imlement it on our own.
Check out https://sourceforge.net/projects/timeoutpatchhib/ for our source (LGPL just as requested by hibernate).
I attached our current source code to the Jira issue. New versions will be published on sourceforge, please refer to https://sourceforge.net/projects/timeoutpatchhib/ for the most current one. The attached source only includes the code to support the TimeLimitedCollector.
We also have an experimental version which tries to find the reason of a BooleanQuery.TooManyClausesException within the offending user search term. For more information take a look at the sourceforge project.
Note: We didn't overide the query.setTimeout(int) method because we didn't know if this would have caused other side effects. So we created a method query.setTimeout(long).
Changed Methods:
- org.hibernate.search.FullTextQuery
-- +isSearchTimoutExceeded()
-- +setTimeout(long)
-- +getTimeout()
- org.hibernate.search.query.FullTextQueryImpl
-- getQueryHits(IndexSearcher, Integer)
-- +isSearchTimoutExceeded()
-- +setTimeout(long)
-- +getTimeout()
- org.hibernate.search.query.QueryHits
-- Constructors
-- scoreDoc(int)
-- updateTopDocs(int)
-- +getTopDocCollector(int)
-- +getHitCollectorForSearch(TopDocCollector)
-- +isTimeLimitExceeded()
--
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
14 years, 2 months
[Hibernate-JIRA] Created: (ANN-668) Method in entity with return type of ArrayList<Object[]> causes failure to build session factory
by Clint Popetz (JIRA)
Method in entity with return type of ArrayList<Object[]> causes failure to build session factory
------------------------------------------------------------------------------------------------
Key: ANN-668
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-668
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga
Environment: Hibernate 3.2.X, no database needed (happens during factory build before connecting to db)
Reporter: Clint Popetz
Attachments: propertyTypeExtractorBug.tar.gz
The following source:
@javax.persistence.Entity
public class TestEntity {
@javax.persistence.Id
public int Id;
public java.util.ArrayList<Object[]> badMethod() { return null; }
public static void main(String args[]) {
new org.hibernate.cfg.AnnotationConfiguration().addAnnotatedClass(TestEntity
.class).configure().buildSessionFactory();
}
}
will cause:
java.lang.IllegalArgumentException: No PropertyTypeExtractor available for type void
at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.toXType(JavaReflectionManager.java:164)^M
at org.hibernate.annotations.common.reflection.java.JavaXMethod.create(JavaXMethod.java:18)
at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.getXMethod(JavaReflectionManager.java:128)
at org.hibernate.annotations.common.reflection.java.JavaXClass.getDeclaredMethods(JavaXClass.java:114)
at org.hibernate.validator.ClassValidator.initValidator(ClassValidator.java:214)
at org.hibernate.validator.ClassValidator.<init>(ClassValidator.java:133)
at org.hibernate.validator.event.ValidateEventListener.initialize(ValidateEventListener.java:91)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:356)
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1304)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
Changing the return type to List<Object[]> avoids the bug.
Attached is a tgz of an ant-buildable project; typing "ant run" will illustrate the bug.
--
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
14 years, 2 months
[Hibernate-JIRA] Created: (HHH-3873) DB2Dialect.getLimitString raise DB2 error message when called with limit=0
by Julien Kronegg (JIRA)
DB2Dialect.getLimitString raise DB2 error message when called with limit=0
--------------------------------------------------------------------------
Key: HHH-3873
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3873
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: DB2,
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/hibernate/core/branches/Branch...
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/hibernate/core/branches/Branch...
Reporter: Julien Kronegg
Priority: Minor
Executing a query called with setMaxResults(n) makes the underlying Hibernate code to call DB2Dialect.getLimitString.
While this is working fine in general case, the following database error is raised when setting the maximum number of results to zero:
SqlException: NUMBER 0 DIRECTLY SPECIFIED IN AN SQL STATEMENT IS OUTSIDE THE RANGE OF ALLOWABLE VALUES IN THIS CONTEXT (1, 2147483647)
This is due to the getLimitString method in classes DB2400Dialect and DB2390Dialect :
public String getLimitString(String sql, int offset, int limit) {
return new StringBuffer(sql.length() + 40)
.append(sql)
.append(" fetch first ")
.append(limit)
.append(" rows only ")
.toString();
}
When the limit parameter is set to zero, the fetch limit is appended, which explains why the error message occur.
Solution:
------------
When the limit is 0, there should be no "fetch first" instruction appended (as 0 is the general convention for "no limit"). The code would be:
public String getLimitString(String sql, int offset, int limit) {
+ if (limit==0) return sql;
return new StringBuffer(sql.length() + 40)
.append(sql)
.append(" fetch first ")
.append(limit)
.append(" rows only ")
.toString();
}
Workaround:
------------------
In order to avoid the error message, getLimitString(n) or setMaxResults(n) should be called with the 'newN' argument:
int newN = (n==0?Integer.MAX_VALUE:n);
Note: since the workaround is quite easy, I set the priority to "Minor"
--
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
14 years, 2 months