title: EntityManager refresh problem
body: <p>I'm getting this error from my EntityManager when I call the refresh function.</p>
  
  <pre><code>public void saveProduct(Product product) {
      entityManager.refresh(product);
  }
  </code></pre>
  
  <p>I heard this could be a bug with Spring/Hibernate, however I'm not sure how to get around this.</p>
  
  <p>Edit: 
  the error is </p>
  
  <pre><code>java.lang.IllegalArgumentException: Entity not managed
  org.hibernate.ejb.AbstractEntityManagerImpl.refresh(AbstractEntityManagerImpl.java:268)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:597)
  org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:358)
  $Proxy17.refresh(Unknown Source)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:597)
  org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:198)
  $Proxy11.refresh(Unknown Source)
  springapp.repository.JdbcProductDao.saveProduct(JdbcProductDao.java:66)
  springapp.service.SimpleProductManager.increasePrice(SimpleProductManager.java:28)
  springapp.web.PriceIncreaseFormController.onSubmit(PriceIncreaseFormController.java:39)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  java.lang.reflect.Method.invoke(Method.java:597)
  org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:421)
  org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:136)
  org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
  org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
  org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  </code></pre>