Hi Everyone,
After upgrading to Hibernate Search 3.3CR1, Core 3.6 Final versions, (Oracle 10g DB; XE 10g test environment) I've encountered the following Exception on a preaviously working query:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See
http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "AWT-EventQueue-0" org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2536)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
at org.hibernate.search.engine.ObjectLoaderHelper.initializeObjects(ObjectLoaderHelper.java:116)
at org.hibernate.search.engine.QueryLoader.executeLoad(QueryLoader.java:80)
at org.hibernate.search.engine.AbstractLoader.load(AbstractLoader.java:70)
at org.hibernate.search.query.FullTextQueryImpl.list(FullTextQueryImpl.java:317)
at org.hibernate.search.jpa.impl.FullTextQueryImpl.getResultList(FullTextQueryImpl.java:137)
at faun.views.forms.SearchForm.refreshButtonActionPerformed(SearchForm.java:724)
at faun.views.forms.SearchForm.access$1(SearchForm.java:706)
at faun.views.forms.SearchForm$FormListener.actionPerformed(SearchForm.java:692)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "THIS_"."IDCOL": invalid identifier
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:205)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:861)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1145)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1267)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3449)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3493)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1491)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
at org.hibernate.loader.Loader.doQuery(Loader.java:802)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2533)
... 38 more
I'm working on an Eclipse JPA project, persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/ ... ce_2_0.xsd">
<persistence-unit name="FaunPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>faun.persistence.Ajanlatok</class>
<class>faun.persistence.DmDcskCsCskTarif</class>
<class>faun.persistence.DmDcskMobk</class>
<class>faun.persistence.DmDcskCalcData</class>
<properties>
<property name="hibernate.connection.username" value="agotadaniel"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
<property name="hibernate.connection.password" value="Hid1234"/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@192.168.121.160:1521:tshid"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
<!-- <property name="hibernate.search.default.indexBase" value="/indexes"/>-->
<property name="hibernate.lucene.default.directory_provider" value="org.hibernate.lucene.store.RAMDirectoryProvider"/>
</properties>
</persistence-unit>
</persistence>
Where the class faun.persistence.Ajanlatok is indexed (via annotations) and queried against as:
EntityManager em = Logic.getEntityManager();
FullTextEntityManager entityManager = new FullTextEntityManagerImpl(em);
List<Ajanlatok> items = em
.createNativeQuery(
"select * from DM_DCSK_Ajanlatok ",
Ajanlatok.class).getResultList();
for (Ajanlatok item : items) {
entityManager.index(item);
}
....
private org.apache.lucene.search.Query buildLuceneQuery(
String searchString,
Class<?> searchedEntity) {
org.apache.lucene.search.Query luceneQuery = null;
String[] productFields = { "col1", "col2"};
MultiFieldQueryParser parser = new MultiFieldQueryParser(Version.LUCENE_30, productFields, new StandardAnalyzer(Version.LUCENE_30));
try {
luceneQuery = parser.parse(searchString);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
....
org.apache.lucene.search.Query luceneQuery = buildLuceneQuery(searchString, Ajanlatok.class);
query = entityManager.createFullTextQuery(luceneQuery,
Ajanlatok.class);
java.util.Collection data = query.getResultList();
PhraseQuery works, but gives no results (probably separate issue)
FuzzyQuery doesn't work either, nor does QueryParser implemented as follows:
// StringTokenizer st =
// new StringTokenizer(searchString, " ");
// PhraseQuery query = new PhraseQuery();
// while (st.hasMoreTokens()) {
// String token = st.nextToken();
// query.add(new Term("col1",token
// ));
// }
//
// luceneQuery = query;//parser.parse( words );
//
//
// String searchQuery = "col1:KarĂ¡t~";
// QueryParser parser = new QueryParser(Version.LUCENE_30,
// "title",
// new StandardAnalyzer(Version.LUCENE_30)
// );
Based on the affected clases the problem seems to be parser implementation related and has something to do with the way Hibernate handles aliases...(the same time I upgraded to 3.0CR1 had to change to a table definition where the columns where defined as aliases -> column names in "" in the generated create table SQL statement: create table tableName as select * from source, looking at the generated code in SQLDeveloper it contained "" quotes... I have no clue wether this could cause the issue actually :( )
Thanks in advance, Daniel