[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
[Hibernate-JIRA] Created: (HHH-5168) DB2Dialect generates CROSS JOINs which aren't supported
by Grzegorz Olędzki (JIRA)
DB2Dialect generates CROSS JOINs which aren't supported
-------------------------------------------------------
Key: HHH-5168
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5168
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.0-Final
Environment: Hibernate 3.5.0-Final, using hibernate-jpa-2.0-api-1.0.0.Final.jar, DB2/NT SQL09013
Reporter: Grzegorz Olędzki
When executing a simple JPQL query:
{code}
SELECT st FROM ScheduledTask st WHERE (NOT st.status = 'COMPLETED') AND st.active = TRUE AND st.task.group = :group
{code}
Hibernate generates the following SQL query:
{code}
select scheduledt0_.QSID as col_0_0_
from SCHSCHEDTASK_QS scheduledt0_ cross join SCHTASK_QT task1_
where scheduledt0_.QTID=task1_.QTID and scheduledt0_.QSSTATUS<>'COMPLETED' and scheduledt0_.QSACTIVE=1 and task1_.QTGROUP=?
{code}
which crashes with:
{code}
2010-04-28 10:14:18,551 WARN [org.hibernate.util.JDBCExceptionReporter]/[org.hibernate.util.JDBCExceptionReporter]
SQL Error: -104, SQLState: 42601
2010-04-28 10:14:18,552 ERROR [org.hibernate.util.JDBCExceptionReporter]/[org.hibernate.util.JDBCExceptionReporter]
DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: cross;TASK_QS scheduledt0_;<space>
2010-04-28 10:14:18,552 WARN [org.hibernate.util.JDBCExceptionReporter]/[org.hibernate.util.JDBCExceptionReporter]
SQL Error: -727, SQLState: 56098
2010-04-28 10:14:18,553 ERROR [org.hibernate.util.JDBCExceptionReporter]/[org.hibernate.util.JDBCExceptionReporter]
DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-104;42601;cross|TASK_QS scheduledt0_|<space>
2010-04-28 10:14:18,554 WARN [org.hibernate.util.JDBCExceptionReporter]/[org.hibernate.util.JDBCExceptionReporter]
SQL Error: -727, SQLState: 56098
2010-04-28 10:14:18,554 ERROR [org.hibernate.util.JDBCExceptionReporter]/[org.hibernate.util.JDBCExceptionReporter]
DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-104;42601;cross|TASK_QS scheduledt0_|<space>
{code}
The very same JPQL query works on MySQL database (the actual SQL query uses CROSS JOIN too).
When trying to run the same SQL on DB2 manually in a database client the error message is the same (-104, 42601).
A subtle change in the query, i.e. replacing CROSS JOIN with a comma (,) seems to fix the problem - both manually and using Hibernate-based application.
Using the following DB2Dialect seems to help:
{code}
public class DB2Dialect extends org.hibernate.dialect.DB2Dialect {
@Override
public String getCrossJoinSeparator() {
return ", ";
}
}
{code}
--
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-4074) Polymorphic queries avoid with polymorphism="explicit" in hbm.xml file doesn't work
by Radics Laszlo (JIRA)
Polymorphic queries avoid with polymorphism="explicit" in hbm.xml file doesn't work
-----------------------------------------------------------------------------------
Key: HHH-4074
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4074
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: hibernate 3.3.2
Oracle 9i
Reporter: Radics Laszlo
hbm.xml:
<hibernate-mapping default-cascade="none">
<class name="hu.raiffeisen.aps.soa.entity.collateral.AncestorImpl" table="ANCESTOR" dynamic-insert="false" dynamic-update="false" polymorphism="explicit">
<id name="id" type="java.lang.Long" unsaved-value="null">
<column name="ID" sql-type="NUMBER(19)"/>
<generator class="sequence">
<param name="sequence">ANCESTOR_SEQ</param>
</generator>
</id>
<property name="top" type="java.lang.Long">
<column name="TOP" not-null="true" unique="false" sql-type="NUMBER(19)"/>
</property>
<union-subclass name="hu.raiffeisen.aps.soa.entity.collateral.DescendantImpl" table="DESCENDANT" dynamic-insert="false" dynamic-update="false" abstract="false">
<property name="bottom" type="java.lang.Long">
<column name="BOTTOM" not-null="true" unique="false" sql-type="NUMBER(19)"/>
</property>
</union-subclass>
</class>
</hibernate-mapping>
hql: "from AncestorImpl" fetch both ancestor and descendant rows
--
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