-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Programmatic API and not working FullTextIndexEventListener
PostPosted: Wed Apr 04, 2012 6:19 am 
Newbie

Joined: Wed Mar 08, 2006 11:12 am
Posts: 16
Hi all,
I'm facing problem as mentioned in the subject.
We use following configuration: Hibernate 4.0.1.Final, HibernateSearch 4.0.0.Final in Glassfish 3.1.2 environment (JPA).

We used annotation based configuration of the HSearch in past and everything worked fine, but now we have to change it to programmatic configuration. So I created factory class that provides SearchMapping instance and registered this factory via 'hibernate.search.model_mapping' property in the persistence.xml file.

1) When using already created index files, searching works fine
2) When updating any existing entity (via merge operation) index files are not touched at all
3) When inserting new entity only 2 fields are inserted into index file: _hibernate_class and id column, even though 2 more columns are indexing-enabled

I checked log output and found info, that FullTextIndexEventListener was correctly activated:
INFO: DEBUG 11:37:02 Hibernate Search event listeners activated (org.hibernate.search.event.impl.FullTextIndexEventListener:147)

This is my config factory:

Code:
public final class SearchMappingConfiguration {

    @Factory
    public SearchMapping build() {
        SearchMapping mapping = new SearchMapping();
        mapping.entity(Prospect.class).indexed()
                        .property("lastUpdate", METHOD).field().name("lastUpdate").store(YES)
                        .property("name", METHOD).field().name("name");
    }
}


The Prospect class is simple POJO class using only ejb3 annotations (defining @Id).

I have no idea what might be wrong and I expect that programmatic API shall work also in our environment :).

I really appreciate any hint or advice.
thanx


Top
 Profile  
 
 Post subject: Re: Programmatic API and not working FullTextIndexEventListener
PostPosted: Tue Apr 24, 2012 5:12 am 
Newbie

Joined: Wed Mar 08, 2006 11:12 am
Posts: 16
my following debugging has shown following:

1) the listeners are notified correctly, but the DocumentBuilder, used here to find 'dirty data', seems to not know anything about programmatic entity configuration. it considers only annotation configuration .... as far as I understood the source code.
2) I also tried the full manual index rebuild and new index files again contained only _hibernate_class and id column

I know there is notice that programmatic api feature is still experimental, but to update index files is really essential.

Is really something wrong with my code and/or configuration or this functionality is not yet implemented?

thanx for any advice


Top
 Profile  
 
 Post subject: Re: Programmatic API and not working FullTextIndexEventListener
PostPosted: Wed Apr 25, 2012 6:46 am 
Newbie

Joined: Wed Mar 08, 2006 11:12 am
Posts: 16
so, we've finally located the real cause of our problem.

The programmatic api does't work for entities, that extends base entity annotated as @MappedSuperclass.

So, explained on example above:

If prospect entity is declared like this, it works fine.

Code:
@Entity
public class Prospect {
  ..field definitinss
}


But if the definition is like this, programmatic api is ignored and only _hibernate_class and prospectId is stored in lucene index files.

Code:
@Entity
public class Prospect extends BaseEntity {
  // empty
}

@MappedSuperclass
public abstract class BaseEntity {
...field definitions
}



Could someone from Hibernate team react on this? Is this really missing functionality in HibernateSearch?


Top
 Profile  
 
 Post subject: Re: Programmatic API and not working FullTextIndexEventListener
PostPosted: Wed Apr 25, 2012 11:49 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
thanks for debugging it! It looks like you're correct, as I've skimmed throught the testsuite and while I would expect this to work, we don't have a test covering for this.

Could you please open a JIRA issue and describe your findings?
https://hibernate.onjira.com/browse/HSEARCH

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Programmatic API and not working FullTextIndexEventListener
PostPosted: Thu Apr 26, 2012 5:09 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
thanks!

https://hibernate.onjira.com/browse/HSEARCH-1108

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.