Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 855948

Summary: Fields declared on @MappedSuperclass parent are not recognized on child entity by programmatic API mapping
Product: [Retired] JBoss Enterprise WFK Platform 2 Reporter: Emil Cervenan <ecervena>
Component: HibernateSearchAssignee: Brett Meyer <brmeyer>
Status: CLOSED NOTABUG QA Contact: Karel Piwko <kpiwko>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.0.0.GACC: brmeyer, irooskov, mnovotny, myarboro, ppenicka, sanne, snagarwa, theute
Target Milestone: ---   
Target Release: 2.2.0   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Known Issue
Doc Text:
Programmatic API mapping does not recognize Hibernate Search fields inherited from parent entities annotated with @MappedSuperclass. As a consequence, Hibernate Search views the fields as unmapped, resulting in a SearchException. This is not considered a bug, but a by-design behaviour that can only be addressed by a functionality enhancement. Until the functionality is enhanced, the issue can be worked around by overriding the getter methods of the inherited fields in the child entities.
Story Points: ---
Clone Of:
: 947491 (view as bug list) Environment:
Last Closed: 2013-01-31 16:57:59 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 947491    

Description Emil Cervenan 2012-09-10 17:30:00 UTC
Description of problem:
Fields declared on @MappedSuperclass parent are not recognized on child entity by programmatic API mapping.

Workaround:
Overide getters on child entity.

Version-Release number of selected component (if applicable):
hibernate-search-4.1.0.Final, wfk-2.0.0.GA


How reproducible:
@MappedSuperclass
public abstract class FooAbstract {
    protected String bar;

    public String getBar() {
        return this.bar
    }
    ...
}

@Entity
public class Foo extends FooAbstract {}

@Factory
public SearchMapping getSearchMapping() {
    SearchMapping mapping = new SearchMapping();
    mapping
        .entity(Foo.class).indexed()
            .property("bar", ElementType.METHOD)
                .field();
}


Steps to Reproduce:
1. create data model with inheritance
2. map indexes using programmatic api
3. try to get inherited field value from extended entity
  
Actual results:
 org.hibernate.search.SearchException: Unable to find field bar in ...


Expected results:
 return value of field

Additional info:
reported on jira too: https://hibernate.onjira.com/browse/HSEARCH-1108

Comment 1 Marek Novotny 2012-09-14 06:32:52 UTC
There is a discussion about this at HSEARCH-1108 - and this is not a bug, but request for an improvement/feature request.

https://hibernate.onjira.com/browse/HSEARCH-1108?focusedCommentId=46619&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-46619

Comment 2 mark yarborough 2012-11-05 15:29:56 UTC
Known issue for WFK 2.1, should be release noted.

Comment 4 Sneha 2013-03-21 08:57:38 UTC
Updated Doc Text.

Comment 5 Petr Penicka 2013-04-02 14:51:02 UTC
As this is no longer considered a bug, I have moved this from known issues to resolved issues in WFK 2.2.0 Release Notes.

The information will be included in the Hibernate Search Guide in WFK 2.3.0, a cloned issue is created for the purpose.