-->
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.  [ 3 posts ] 
Author Message
 Post subject: Programmatically configure Hibernate Search in Seam
PostPosted: Tue Aug 24, 2010 6:23 pm 
Beginner
Beginner

Joined: Tue Oct 07, 2008 7:05 pm
Posts: 27
As the title states, I'm trying to programmatically map Hibernate search in a container that bootstraps the EMF. Therefore I don't have the ability to set the EMF properties with the SearchMapping object. In my search, I found this issue:

http://opensource.atlassian.com/project ... SEARCH-429

Which suggests this is now doable. However, I'm a little unclear on the details of how this works...particularly in Seam. Can someone possibly provide me a few clues of how to get this working in Seam?

Regards,

JF


Top
 Profile  
 
 Post subject: Re: Programmatically configure Hibernate Search in Seam
PostPosted: Wed Aug 25, 2010 5:33 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

you should be able to add the following to your configuration (using property notation here, but could be xml as well depending on what you use):

Code:
hibernate.search.model_mapping=my.ProgrammaticSearchMappingFactory


where ProgrammaticSearchMappingFactory needs a method annotated with @Factory returning a SearchMapping instance:

Code:
public class ProgrammaticSearchMappingFactory {
      
   @Factory
   public SearchMapping build() {
      SearchMapping mapping = new SearchMapping();
                      ...
                      return mapping;
           }
}


--Hardy


Top
 Profile  
 
 Post subject: Re: Programmatically configure Hibernate Search in Seam
PostPosted: Wed Aug 25, 2010 10:56 am 
Beginner
Beginner

Joined: Tue Oct 07, 2008 7:05 pm
Posts: 27
Yep, that worked. For reference, in Seam since I configure the EMF in the components.xml file, I used something like this:

Code:
    <persistence:entity-manager-factory name="myDatabase">
      <persistence:persistence-unit-properties>
        <key>hibernate.search.model_mapping</key>
        <value>com.mycompany.SearchMappingFactory</value>
      </persistence:persistence-unit-properties>
    </persistence:entity-manager-factory>


Thanks for the tip.

-JF


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.