From what you are saying, I would have a look at the :
http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.html

My best guess is that this would fix your issue. If not, you probably have an issue with the way you are dealing with your entities.

Denis.


Chris Cranford a écrit :
I have done a fair amount of reading today on the topic again and
developed a few simple classes to support my service, model, and dao
architecture for using Hibernate 3.3.2 and Spring 2 with Struts2.  The
problem I am currently facing is I get a detached error when deleting
an object and I get a null pointer exception in SessionImpl.java when
I try to locate an object by its id.

/* GenericDAO.java */

public T findById(Object id) {
  return(getEntityManager().find(clazz, id));
}

public void delete(T entity) {
  getEntityManager().remove(entity);
}

Some posts I have seen say for the delete, you should use
getReference() or merge() in order to get an association to the entity
before you call the remove() method.  I attempted to use the same type
of logic with getReference() during the findById() and it failed.

Am I missing something in my configuration with Hibernate/Spring with
respect to the session factory or something that I need to revisit?
It really seems as though I may have a missing component or a poor
configuration somewhere.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to