[hibernate-dev] Fwd: Hibernate Search 3.1.0GA Bugs after HSEARCH-160

Sanne Grinovero sanne.grinovero at gmail.com
Mon Apr 6 05:16:52 EDT 2009


should this be fixed for 3.1.1?
Is there a reason to not accept @Indexed on an abstract class?

FYI the forum reference : http://forum.hibernate.org/viewtopic.php?t=996141

Sanne

2009/4/6 Emmanuel Bernard <emmanuel at hibernate.org>:
>
>
> Begin forwarded message:
>
> From: Zhendong Chen <chenzd at pds.de>
> Date:  April 6, 2009 08:31:12  CEDT
> To: emmanuel at hibernate.org
> Subject: Hibernate Search 3.1.0GA Bugs after HSEARCH-160
> Reply-To: chenzd at pds.de
> Hibernate version: 3.3.1GA
> Hibernate Search 3.1.0GA
> Lucene 2.4.0
>
> Hallo,
>
> we have a abstract class a with annotation like this
>
> @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
> @Indexed
>
> this class is annotate as a single_table, we got this exception:
> Cannot mix criteria and multiple entity types
>
> and this change was happend after HSEARCH-160.
> We have make a quick fix for this, it's not nice, maybe you can fix it in
> the next version
>
> public class SearchFactoryImpl implements SearchFactoryImplementor {
> ...
> private void initDocumentBuilders(SearchConfiguration cfg, ReflectionManager
> reflectionManager) {
> ...
> //if ( mappedXClass.isAbstract() ) {
> //      log.warn( "Abstract classes can never insert index documents. Remove
> @Indexed." );
> //      continue;
> //}
> ...
> }
>
> ...
>
> Set<Class<?>> getIndexedClasses(Class<?>[] classes) {
>          Set<Class<?>> idexedClasses = new HashSet<Class<?>>();
>          for ( Class clazz : classes ) {
>
>             Inheritance inheritance = (Inheritance)
> clazz.getAnnotation(Inheritance.class);
>             if(inheritance!=null &&
> inheritance.strategy().equals(InheritanceType.SINGLE_TABLE))
>             {
>                idexedClasses.add(clazz);
>             }
>             else
>             {
>             Set<Class<?>> set = classToIndexedClass.get( clazz );
>             if ( set != null ) {
>                // at this point we don't have to care about including
> indexed subclasses of a indexed class
>                // MultiClassesQueryLoader will take care of this later and
> optimise the queries
>                idexedClasses.addAll( set );
>             }
>             }
>          }
>          if ( log.isTraceEnabled() ) {
>             log.trace( "Targeted indexed classes for {}: {}",
> Arrays.toString( classes ), idexedClasses );
>          }
>          return idexedClasses;
>       }
> ...
> }
>
> --
> Zhendong Chen
> -----------------------------------------------------------------------------------------------------------------
> PDS Programm + Datenservice GmbH
> Mühlenstrasse 22  -  27356 Rotenburg (Wümme)
> Telefon: (04261) 855-01, Fax: (04261) 855-335
> E-Mail: zhendong.chen at pds.de, Homepage: www.pds.de
>
> Geschäftsleitung: Hinrich Hamelberg, Stephan Mau, Handelsregister Walsrode
> HRB 70186,
> Steuer-Nr.: 40/202/02809, USt-IdNr.: DE 116324331
>
> _______________________________________________
> 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