[hibernate-dev] Fwd: Hibernate Search 3.1.0GA Bugs after HSEARCH-160
Emmanuel Bernard
emmanuel at hibernate.org
Mon Apr 6 04:40:24 EDT 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20090406/cc61f1fb/attachment.html
More information about the hibernate-dev
mailing list