[Hibernate-JIRA] Created: (HSEARCH-115) Add a default value for indexing null value
by Julien Brulin (JIRA)
Add a default value for indexing null value
-------------------------------------------
Key: HSEARCH-115
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-115
Project: Hibernate Search
Issue Type: Improvement
Components: mapping
Reporter: Julien Brulin
Hi,
Null elements are not indexed by lucene then it's not easy to use a nullable property in lucene query.
I have a TagTranslation entity in my model with a nullable property language. In this case null is used as default language for tag translation.
Each translation may have many variations like synonyms.
Because I can specified a default value for null value in the @Field annotation like this @Field(index=Index.UN_TOKENIZED, store=Store.NO, default='null'), i can't search a cat tag with a default translation like this : +value:cat* +lang:null
<pre></code>
@Entity()
@Table(name="indexing_tag_trans")
@org.hibernate.annotations.Cache(usage=org.hibernate.annotations.CacheConcurrencyStrategy.READ_WRITE)
@Indexed
public class TagTranslation implements java.io.Serializable {
private static final long serialVersionUID = -1065316566731456110L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@DocumentId
private Integer id;
@Field(index=Index.UN_TOKENIZED, store=Store.NO)
private String language;
@Field(index=Index.TOKENIZED, store=Store.YES)
private String value;
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
@JoinColumn(name="translation_id")
@IndexedEmbedded
private List<TagVariation> variations = new LinkedList<TagVariation>();
public TagTranslation() { }
...
</code>
</pre>
What do you think about that ?
Ps: sorry for english write, i am a french guy.
--
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: (HSEARCH-390) HibernateSearchResourceLoader uses default charset for reading resources
by Ivan Holub (JIRA)
HibernateSearchResourceLoader uses default charset for reading resources
------------------------------------------------------------------------
Key: HSEARCH-390
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-390
Project: Hibernate Search
Issue Type: Bug
Components: analyzer
Affects Versions: 3.1.1.GA
Reporter: Ivan Holub
HibernateSearchResourceLoader uses default charset for reading resources.
So stop words are not working for other languages.
@AnalyzerDef(name="ru",
tokenizer=(a)TokenizerDef(factory=StandardTokenizerFactory.class),
filters={
@TokenFilterDef(factory=StandardFilterFactory.class),
@TokenFilterDef(factory=LowerCaseFilterFactory.class),
@TokenFilterDef(factory=StopFilterFactory.class,
params=@Parameter(name="words",
value="stopwords/stopwords_ru.txt")),
@TokenFilterDef(factory=SnowballPorterFilterFactory.class,
params=@Parameter(name="language",
value="Russian"))
stopwords/stopwords_ru.txt is UTF-8 file
To fix the problem I constructed Analyzer in separate class and without using AnalyzerDef.
--
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: (EJB-435) @SqlResultSetMapping gives Invalid Column for columns not in select clause
by Rachit (JIRA)
@SqlResultSetMapping gives Invalid Column for columns not in select clause
--------------------------------------------------------------------------
Key: EJB-435
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-435
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.4.0.GA
Environment: DB: Oracle 10g, OS: Win XP, Hibernate 3 using JPA entitymanager
Reporter: Rachit
Hi,
A very simple usage of SqlResultSetMapping. I want to retrieve only country Name using native query. I have specified one column country name to be fetched and mapped in Object.
@SqlResultSetMapping(name = "CountryCountry", entities = { @EntityResult(entityClass = Country.class, fields = { @FieldResult(name = "countryName", column = "COUNTRY_NAME") })
public void testComplexer0NativeQuery() {
em = emf.createEntityManager();
Query query = em.createNativeQuery(
"select iso.COUNTRY_NAME from Country iso",
"CountryCountry");
List list = query.getResultList();
System.out.println(list.size());
System.out.println(list.get(0).getClass());
}
Running this I get "INFO: could not read column value from result set: ISO1_2_0_; Invalid column name" exception. The whole stack trace :
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2231)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:67)
... 21 more
Caused by: java.sql.SQLException: Invalid column name
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:6348)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1557)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1549)
at org.hibernate.type.StringType.get(StringType.java:41)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:184)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:173)
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:1121)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:588)
at org.hibernate.loader.Loader.doQuery(Loader.java:724)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
... 28 more
Hibernate is trying to fetch all the columns present in entity to create the object. I am only interested in column/s I have specified in "@FieldResult".
If I retrieve all fields in entity, It works fine though.
Thanks and Regards.
--
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