title: Hibernate One-to-one Mapping with interface.i need advice
body: <p>i'm developing an application where all the pojos are exposed as interface but we map the real implementation class.we are using spring and JPA annotation.i'm about to test the one-to-one relationship and i'm having a light problem with the interface.</p>
  
  <blockquote>
    <p>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionContainer' defined in class path resource [META-INF/model-config.xml]:<br>
    Cannot resolve reference to bean 'sessionFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException:<br>
     Error creating bean with name 'sessionFactory' defined in class path resource [META-INF/model-config.xml]:<br>
    Invocation of init method failed; nested exception is org.hibernate.AnnotationException:<br>
    @OneToOne or @ManyToOne on com.mycompany.project.subproject.model.UserAccountImpl.profile references an unknown entity: com.mycompany.project.</p>
  </blockquote>
  
  <p>so before this class all the other mapped class are working as expected so i'll only post part of the <code>applicationContext</code> file that i named <code>model-config.xml</code></p>
  
  <pre><code>&lt;property name="hibernateProperties"&gt;
      &lt;props&gt;
          &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;
          &lt;prop key="hibernate.show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt;
          &lt;prop key="hibernate.hbm2ddl.auto"&gt;${hibernate.hbm2ddl.auto}&lt;/prop&gt;
          &lt;prop key="hibernate.format_sql"&gt;${hibernate.format_sql}&lt;/prop&gt;
      &lt;/props&gt;
  &lt;/property&gt;
  &lt;property name="annotatedClasses"&gt;
      &lt;list&gt;
         ...
          &lt;value&gt;com.mycompany.project.subproject.model.UserProfileImpl&lt;/value&gt;
          &lt;value&gt;com.mycompany.project.subproject.model.UserAccountImpl&lt;/value&gt;
         ...
      &lt;/list&gt;
  &lt;/property&gt;
  </code></pre>
  
  <p>here are the two involved class <code>UserProfileImpl.java</code> and <code>UserAccountImpl.java</code></p>
  
  <pre><code>//UserAccountImpl Class
  @Entity
  @Table(name ="USER_ACCOUNT")
  public class UserAccountImpl implements UserAccount {
  
    @Id @GeneratedValue
    @Column(name="USER_ACCOUNT_ID")
    private Long ID;
  
    ...
  
    @OneToOne
    @JoinColumn(name="USER_PROFILE_ID")
    private UserProfile profile;
  
    ...
  }
  
  //UserProfileImpl class
  @Entity
  @Table(name="USER_PROFILE")
  public class UserProfileImpl implements UserProfile {
  
    @Id @GeneratedValue
    @Column(name="USER_PROFILE_ID")
    private Long ID;
    ....
  
    @OneToOne(mappedBy="profile")
    private UserAccount userAccount;
    ....
  }
  </code></pre>
  
  <p>i'm still not very confortable with hibernate yet so i'm wondering if i should Change the <code>UserProfile</code> reference in <code>UserAccountImpl</code> to <code>UserProfileImpl</code>.Then again the same can happen in the <code>UserProfileImpl</code> for <code>userAccount</code> reference  since it's a bidirectional navigation stuff.
  What's the best option that will no break the consistency of the structure?
  Thanks for reading this</p>