title: Hibernate-search cannot find field in mapped component
body: <p>I have a User class that contains an Address. I have mapped the Address as a component. The Address variable in User is defined as @IndexEmbedded and the Address class itself as @Embeddable. The user table in the database contains columns for the fields from Address too. 
  I can save the user and confirmed it does save the address fields.
  I can search with a Hibernate Search Query in the user fields, this delivers expected results. However, searching for a field in Address gives the following error : </p>
  
  <pre><code>java.lang.AssertionError: Unable to find field address.place in com.prism.model.user.impl.UserImpl
  at org.junit.Assert.fail(Assert.java:88)
  at com.prism.dao.hibernate.UserDAOTest.testSearchUser(UserDAOTest.java:104)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
  at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
  at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
  at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:233)
  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:87)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
  at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
  at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
  at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
  at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:176)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
  </code></pre>
  
  <p>I am using the following versions : </p>
  
  <ul>
  <li>hibernate-4.3.5</li>
  <li>hibernate-search-4.5.1</li>
  <li>spring-4.0.5</li>
  </ul>
  
  <p>Not sure if this is useful info, but the database is MySql 5.6</p>
  
  <p>The User class (omitted gettes and setters) : </p>
  
  <pre><code>    package com.prism.model.user.impl;
  
      import java.io.Serializable;
      import java.util.ArrayList;
      import java.util.Collection;
      import java.util.HashSet;
      import java.util.List;
      import java.util.Set;
  
  import javax.persistence.Column;
  import javax.persistence.Embedded;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  import javax.persistence.Transient;
  
  import org.hibernate.annotations.Type;
  import org.hibernate.search.annotations.DocumentId;
  import org.hibernate.search.annotations.Field;
  import org.hibernate.search.annotations.Indexed;
  import org.hibernate.search.annotations.IndexedEmbedded;
  import org.joda.time.DateTime;
  import org.springframework.security.core.GrantedAuthority;
  import org.springframework.security.core.userdetails.UserDetails;
  
  import com.prism.dao.audit.Auditable;
  import com.prism.model.Address;
  import com.prism.model.impl.AddressImpl;
  import com.prism.model.impl.AuditableObject;
  import com.prism.model.user.Role;
  import com.prism.model.user.User;
  
  /**
   * @see com.prism.model.user.User
   * 
   * &lt;a href="UserImpl.java.html"&gt;&lt;i&gt;View Source&lt;/i&gt;&lt;/a&gt;
   */
  @Indexed
  @Entity
  @Table(name="user")
  public class UserImpl extends AuditableObject implements User, UserDetails, Auditable, Serializable {
  
      /**
       * 
       */
      private static final long serialVersionUID = -34654639867985476L;
      @DocumentId
      @Id @GeneratedValue(strategy=GenerationType.AUTO)
      private long id;
      @Field
      private String username;
      @Field
      private String lastname;
      @Field
      private String middlenames;
      @Field
      private String firstname;
      @Field
      private String fullname;
      @IndexedEmbedded
      @Embedded
      private Address address = new AddressImpl();
  
      // Account properties
      /**
       * The hashed password
       */
      private String password;
      private int passwordtries;
      @Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime")
      @Column(name = "password_last_changed")
      private DateTime passwordLastChanged;
      private boolean enabled;
      @Column(name = "expired")
      private boolean accountExpired;
      @Column(name = "locked")
      private boolean accountLocked;
      @Column(name = "credentials_expired")
      private boolean credentialsExpired;
      private int status;
      @Transient
      private Set&lt;Role&gt; roles = new HashSet&lt;Role&gt;();
  
      UserImpl() {
          super();
      }
  
      &lt;omitted gettes and setters&gt;
  
  }
  </code></pre>
  
  <p>The Address class (getters and setters omitted) :</p>
  
  <pre><code>/**
   * 
   */
  package com.prism.model.impl;
  
  import javax.persistence.Column;
  import javax.persistence.Embeddable;
  import javax.persistence.Transient;
  
  import org.hibernate.search.annotations.Field;
  
  import com.prism.model.Address;
  import com.prism.model.Zipcode;
  
  /**
   * @see com.prism.model.Address
   */
  @Embeddable
  public class AddressImpl implements Address {
  
      @Field
      private String building;
      private String country;
      private String housenumber;
      @Column(name = "housenumber_addon")
      private String housenumberAddon;
      @Field
      private String place;
      @Column(name = "post_address")
      private String postAddressLine;
      @Field
      private String zipcode;
      @Column(name = "pre_address")
      private String preAddressLine;
      @Field
      private String room;
      @Field
      private String street;
  
      &lt;getters and setters&gt;
  
  }
  </code></pre>
  
  <p>The spring application context file used for testing : </p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:security="http://www.springframework.org/schema/security"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/security
      http://www.springframework.org/schema/security/spring-security-3.2.xsd"&gt;
  
      &lt;!-- Hibernate SessionFactory --&gt;
      &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource"/&gt;
          &lt;property name="packagesToScan" value="com.prism" /&gt;
          &lt;property name="entityInterceptor" ref="auditInterceptor"/&gt;
          &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
              &lt;prop key="javax.persistence.validation.mode"&gt;none&lt;/prop&gt;
              &lt;prop key="hibernate.search.default.directory_provider"&gt;filesystem&lt;/prop&gt;
              &lt;prop key="hibernate.search.default.indexBase"&gt;/data/prism/hibernate/indexes&lt;/prop&gt;
              &lt;prop key="jadira.usertype.autoRegisterUserTypes"&gt;true&lt;/prop&gt;
              &lt;prop key="jadira.usertype.databaseZone"&gt;jvm&lt;/prop&gt;
              &lt;prop key="jadira.usertype.javaZone"&gt;jvm&lt;/prop&gt;
          &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="auditInterceptor" class="com.prism.dao.audit.AuditInterceptor"&gt;
      &lt;/bean&gt;
  
       &lt;!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) --&gt;
      &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
      &lt;/bean&gt;
  
      &lt;!-- 
              DAO's 
      --&gt;
      &lt;bean id="dao" class="com.prism.dao.hibernate.BaseDAOHibernate"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="userDAO" class="com.prism.dao.hibernate.UserDAOHibernate"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Any help pointing me in the right direction on how to solve this is welcome. I found a reference to a problem like this <a href="https://hibernate.atlassian.net/browse/HSEARCH-1442" rel="nofollow">here</a>, but from what I read there the versions I use should have that bug fixed. </p>