title: Properly Refresh data from Database JPA - Hibernate
body: <p>I'm currently using the JPA specs to query my objects from the database.</p>
  
  <p>Everytime there's a change made by me (my instance of the software), the items would be properly refreshed.</p>
  
  <p>But, if there's another change made by someone else (other instance, or database change), the items are'nt being properly refreshed.</p>
  
  <p>I'm using a simple "find" with "refresh"</p>
  
  <pre><code>Object found = getManager().find(getModelClass(), id);
  getManager().refresh(found);
  </code></pre>
  
  <p>I'm using a DAO Hierarchy, the "getModelClass" returns my @Entity class like</p>
  
  <pre><code>@Override
  protected Class&lt;?&gt; getModelClass() {
      return ProductCategory.class;
  }
  </code></pre>
  
  <p>And my Manifest / persistence.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
      version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"&gt;
      &lt;persistence-unit name="casa" transaction-type="RESOURCE_LOCAL"&gt;
         &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
  
          &lt;properties&gt;
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /&gt;
              &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" /&gt;
  
              &lt;!-- localhost --&gt;
              &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/database" /&gt;
              &lt;property name="javax.persistence.jdbc.user" value="root" /&gt;
              &lt;property name="javax.persistence.jdbc.password" value="root" /&gt;
  
  
              &lt;property name="hibernate.show_sql" value="false" /&gt;
              &lt;property name="hibernate.format_sql" value="false" /&gt;
              &lt;property name="hibernate.use_sql_comments" value="false" /&gt;
              &lt;property name="hibernate.jdbc.wrap_result_sets" value="false" /&gt;
              &lt;property name="hibernate.hibernate.cache.use_query_cache" value="true" /&gt;
              &lt;property name="hibernate.hbm2ddl.auto" value="update" /&gt; 
  
          &lt;/properties&gt;
  
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>Also each "DAO" have and instance of and EntityManager of it's own.</p>
  
  <p>What I might be doing wrong ?</p>
  
  <p>Appreciate the help!</p>