struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joeradtke <joerad...@yahoo.com>
Subject Re: [ANN] Practical Apache Struts2 Web 2.0 Projects
Date Sun, 02 Jan 2011 22:19:53 GMT

I have solved the persistence problem.

Change EntityManager.persist(event) to

           EntityManager.merge(event)


raxden2 wrote:
> 
> HI! i had the same problem, but I have another problem:
> 
> When i push the button for save Event... throws this exception:
> 
> excepción 
> 
> javax.servlet.ServletException: javax.persistence.PersistenceException:
> org.hibernate.PersistentObjectException: detached entity passed to
> persist: com.fdar.apress.s2.domain.Location
> 
> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
> 
> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
> 
> com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
> 
> com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
> 
> org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
> 
> causa raíz 
> 
> javax.persistence.PersistenceException:
> org.hibernate.PersistentObjectException: detached entity passed to
> persist: com.fdar.apress.s2.domain.Location
> 
> org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
> 
> org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
> 
> com.fdar.apress.s2.services.EventServiceImpl.create(EventServiceImpl.java:24)
> 
> com.fdar.apress.s2.actions.event.SaveEventAction.execute(SaveEventAction.java:32)
> 	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 
> ..............
> 
> causa raíz 
> 
> org.hibernate.PersistentObjectException: detached entity passed to
> persist: com.fdar.apress.s2.domain.Location
> 
> org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:79)
> 	org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:609)
> 	org.hibernate.impl.SessionImpl.persist(SessionImpl.java:601)
> 	org.hibernate.engine.CascadingAction$8.cascade(CascadingAction.java:295)
> 	org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
> 	org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
> 	org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
> 
> ..........
> 
> I need help, i don´t know how resolve this.
> 
> 
> Thanks.
> 
> 
> 
> 
> 
> Ian Roughley wrote:
>> 
>> I'm not sure, and I'm only taking an educated guess at it being 
>> OS/platform-dependent (since a JAR that worked for me had problems for 
>> another user).  Unfortunately I can't reproduce the error.  I'm all for 
>> doing the work to fix the problem if someone has the problem and cycles 
>> to work through testing it.
>> 
>> /Ian
>> 
>> Dave Newton wrote:
>>> --- Ian Roughley <ian@fdar.com> wrote:
>>>   
>>>> The solution provided to me was to change the scope interceptor 
>>>> reference to use a session value of "Model" rather than "model" - see
>>>> below.
>>>>
>>>>   <interceptor-ref name="scope">
>>>>     Model
>>>>     partialEvent
>>>>   </interceptor-ref>
>>>>     
>>>
>>> Hmm, why does that fix it? If it's an OS-dependent issue we should fix
>>> it for
>>> real.
>>>
>>> Dave
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>   
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/-ANN--Practical-Apache-Struts2-Web-2.0-Projects-tp13863084p30573384.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message