[hibernate-dev] HSEARCH-429

Emmanuel Bernard emmanuel at hibernate.org
Fri Dec 4 07:49:29 EST 2009


About the patch you've sent,
There are two issues, I think:

  - providedId should be on IndexedMapping, or is there a reason to  
put @ProvidedId on a non @Indexed entity?
  - you need to create distinct DynamicBoostOnClass and  
DynamicboostOnProperty as the "parent" properties are different and  
that would confuse people.
  - class bridge mapping seems fine though I could not apply it as  
it's not a separate patch

BTW the add-ons really show that we need this interface approach to  
inherit methods from the parent context. It's getting messy and very  
hard to properly add a new method wo forgetting a few places.

On 4 déc. 09, at 10:49, Emmanuel Bernard wrote:

> Hello,
> I'll review your patches today hopefully.
> I am wondering if using Hg or Git could help you / us and what would
> be the impact on the existing architecture.
>
> wrt HSEARCH-429
> hibernate.search.mapping_model should be both a Class and a String
> (configuration). The code must account for that.
> I think the code should not be in SearchConfigurationFromHibernateCore
> as it is equally useful for non Hibernate Core usages. It but be next
> to the core of Hibernate Search's initialization.
>
> On 4 déc. 09, at 09:36, Amin Mohammed-Coleman wrote:
>
>> Hi
>>
>> I had a go at using the @Factory and did something like this:
>>
>> public class SearchMappingFactory {
>>
>>   @Factory
>>    public SearchMapping build() {
>>      SearchMapping mapping = new SearchMapping();
>>       ....build mapping
>>
>>      return mapping;
>>    }
>> }
>>
>> cfg.getProperties().put( "hibernate.search.mapping_model",
>> SearchMappingFactory.class );
>>
>>
>> In SearchConfigurationFromHibernateCore i changed :
>>
>>
>> public SearchMapping getProgrammaticMapping() {
>> 		if (getProperties().get( "hibernate.search.mapping_model" ) ==
>> null) {
>> 			return null;
>> 		}
>> 		Class<?> clazz = (Class<?>)
>> getProperties().get( "hibernate.search.mapping_model" );
>> 		Method[] methods = clazz.getMethods();
>> 		SearchMapping mapping = null;
>> 		boolean hasFactoryAnn = false;
>> 		int count = 0;
>> 		for (Method method : methods) {
>> 			if (method.isAnnotationPresent(Factory.class)) {
>> 				count++;
>> 				hasFactoryAnn = true;
>> 				if ( !method.isAccessible() ) {
>> 					method.setAccessible( true );
>> 				}
>> 				try {
>> 					Object instance = clazz.newInstance();
>> 					mapping = (SearchMapping) method.invoke(instance, new Object[]
>> {});
>> 				} catch (Exception e) {
>> 					throw new SearchException(e);
>> 				}
>> 			}
>> 		}
>> 		if (!hasFactoryAnn) {
>> 			throw new SearchException("No @Factory method defined for
>> building programmatic api.");
>> 		}
>> 		if (count > 1) {
>> 			throw new SearchException("Multiple @Factory methods defined.
>> Only one factory method required.");
>> 		}
>> 		return mapping;
>> 	}
>>
>> I was going to create a patch but I've got stuff such as dynamic
>> boost and classbridge mapping which would've been included in patch
>> and caused mayhem!
>>
>>
>> It's an initial idea...probably has holes i'm sure.  I didn't know
>> whether to send it to the entire group.
>>
>>
>> Cheers
>> Amin
>>
>>
>>
>>
>> On Thu, Dec 3, 2009 at 9:26 AM, Emmanuel Bernard <emmanuel at hibernate.org
>>> wrote:
>> Sounds good.
>> If you go the interface route then fine
>> If you go the annotation route, use the existing @Factory annotation
>> we have. You can also check the code to see how it's implemented for
>> filter.
>>
>>
>> On 2 déc. 09, at 19:29, Sanne Grinovero wrote:
>>
>> Hi Amin,
>> no problem go ahead do some experiments and keep the list informed;  
>> to
>> get that right we will need some different points of view and
>> situations, my case was very situational and would have needed some
>> work to integrate :-)
>>
>> Sanne
>>
>> 2009/12/2 Amin Mohammed-Coleman <aminmc at gmail.com>:
>> Hi Sanne
>> Apologies again for bothering you but I just found this issue on
>> JIRA.  I'm
>> not sure whether to send an email to the mailing list or add a
>> comment on
>> JIRA but do you have any objections (unless you have started work on
>> it) of
>> me having a look at this? I've just finished 2 more mapping classes
>> which
>> Emmanuel is having a look and i'm finishing teh documentation for
>> them.
>> I've finished 2 job interviews so I'm free to take a look at
>> things.  I
>> wanted to run this past you first before I made a move or started any
>> coding.
>>
>> Cheers
>> Amin
>>
>>
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev





More information about the hibernate-dev mailing list