I did a search for
"remove deleted object from associations" in my gmail and came up with a post that sugggested adding a closure to the (Workout) controller called "beforeDelete". I added this and it deletes the items but there is still a problem. The controller stil errors out thinking that they didn't get deleted. I checked the db and the items are deleted so it works.
The problem seems to be references to the workout in the AuthUser domain so they have to be removed and nulled first I think.
Here's the method
def beforeDelete = { workout ->
workout.athlete.lastUpdatedWorkout = null
workout.athlete.removeFromWorkouts(workout)
}
Here's the error:
When trying to delete a workout or a meal I get:
[130922] StackTrace Sanitizing stacktrace:
org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [Meal#116]
at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:1014)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:165)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:218)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)
at org.codehaus.groovy.grails.orm.hibernate.support.GrailsOpenSessionInViewInterceptor.flushIfNecessary(GrailsOpenSessionInViewInterceptor.java:78)
at org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor.postHandle(OpenSessionInViewInterceptor.java:181)
at org.codehaus.groovy.grails.orm.hibernate.support.GrailsOpenSessionInViewInterceptor.postHandle(GrailsOpenSessionInViewInterceptor.java:59)
at org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter.postHandle(WebRequestHandlerInterceptorAdapter.java:61)
at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:257)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:441)
Deleting a workout:
[476516] StackTrace Sanitizing stacktrace:
org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [Workout#48]
at org.hibernate.impl.SessionImpl.forceFlush(SessionImpl.java:1014)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:165)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:218)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)
at org.codehaus.groovy.grails.orm.hibernate.support.GrailsOpenSessionInViewInterceptor.flushIfNecessary(GrailsOpenSessionInViewInterceptor.java:78)
at org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor.postHandle(OpenSessionInViewInterceptor.java:181)
at org.codehaus.groovy.grails.orm.hibernate.support.GrailsOpenSessionInViewInterceptor.postHandle(GrailsOpenSessionInViewInterceptor.java:59)
at org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter.postHandle(WebRequestHandlerInterceptorAdapter.java:61)
at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:257)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:476)
Thursday, April 10, 2008
Thursday, April 3, 2008
Wednesday, April 2, 2008
Tuesday, April 1, 2008
subversion client upgrade (1.3.2 to 1.4.6) issues
I couldn't run svn update on my command line client on my work linux box because I got
[comcast@linuxdevstation workspace-tru2way]$ cd rngth-TRUNK/
[comcast@linuxdevstation rngth-TRUNK]$ svn update
svn: This client is too old to work with working copy '.'; please get a newer Subversion client
[comcast@linuxdevstation rngth-TRUNK]$ svn help
usage: svn [options] [args]
Subversion command-line client, version 1.3.2.
I downloaded the latest subversion-1.4.6 client (I think it's the client) but could not install because when I ran ./configure, I got
checking for Apache module support via DSO through APXS... no
==================================================================
WARNING: skipping the build of mod_dav_svn
--with-apxs or --with-apache must be used
==================================================================
configure: Apache Portable Runtime (APR) library configuration
checking for APR... no
configure: WARNING: APR not found
The Apache Portable Runtime (APR) library cannot be found.
Please install APR on this system and supply the appropriate
--with-apr option to 'configure'
or
get it with SVN and put it in a subdirectory of this source:
svn co \
http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x \
apr
Run that right here in the top level of the Subversion tree,
then run autogen.sh again.
Whichever of the above you do, you probably need to do
something similar for apr-util, either providing both
--with-apr and --with-apr-util to 'configure', or
getting both from SVN with:
svn co \
http://svn.apache.org/repos/asf/apr/apr-util/branches/0.9.x \
apr-util
configure: error: no suitable apr found
Since I didn't need to mess with it (I use the eclipse subclipse client) I didn't pursue it.
[comcast@linuxdevstation workspace-tru2way]$ cd rngth-TRUNK/
[comcast@linuxdevstation rngth-TRUNK]$ svn update
svn: This client is too old to work with working copy '.'; please get a newer Subversion client
[comcast@linuxdevstation rngth-TRUNK]$ svn help
usage: svn
Subversion command-line client, version 1.3.2.
I downloaded the latest subversion-1.4.6 client (I think it's the client) but could not install because when I ran ./configure, I got
checking for Apache module support via DSO through APXS... no
==================================================================
WARNING: skipping the build of mod_dav_svn
--with-apxs or --with-apache must be used
==================================================================
configure: Apache Portable Runtime (APR) library configuration
checking for APR... no
configure: WARNING: APR not found
The Apache Portable Runtime (APR) library cannot be found.
Please install APR on this system and supply the appropriate
--with-apr option to 'configure'
or
get it with SVN and put it in a subdirectory of this source:
svn co \
http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x \
apr
Run that right here in the top level of the Subversion tree,
then run autogen.sh again.
Whichever of the above you do, you probably need to do
something similar for apr-util, either providing both
--with-apr and --with-apr-util to 'configure', or
getting both from SVN with:
svn co \
http://svn.apache.org/repos/asf/apr/apr-util/branches/0.9.x \
apr-util
configure: error: no suitable apr found
Since I didn't need to mess with it (I use the eclipse subclipse client) I didn't pursue it.
Config issues deploying coach to a different server
MySQL: had to grant all permissions to the server ip explicitely like
grant all on coach_acegi2_prod.* to 'user'@'555.137.91.35' identified by 'password';
and had to set the ip explicitely in the grails-app/conf/Config.groovy production section mysql
url = jdbc:mysql://555.137.91.35/coach-0.3.4
grant all on coach_acegi2_prod.* to 'user'@'555.137.91.35' identified by 'password';
and had to set the ip explicitely in the grails-app/conf/Config.groovy production section mysql
url = jdbc:mysql://555.137.91.35/coach-0.3.4
Subscribe to:
Posts (Atom)