oops sorry. yeah typo there, my actual codes uses &&
i was able to fix this somewhat. from how i understand, the hibernate session begins at the start of the initial GORM method call. from my code, i saw that i invoked a "get" from the controller to get the Book instance. this is then passed to the service, which in turn invokes it's own GORM methods (hasError and save). i really don't know if a session flush is invoked as soon as the controller invokes the service.
so what i did was to remove the "get" GORM method (and all GORM in the controller), and instead pass the params map to the service.
any other ideas?
On Sat, Apr 11, 2009 at 11:35 PM, Jeff Brown
<jeff@...> wrote:
On Sat, Apr 11, 2009 at 9:45 AM, Michael Mallete <
mrmallete@...> wrote:
> }
> service:
> service method:
> def update(book)
> {
> if(!book.hasErrors() || book.save())
> {
> //do something
> }
> else
> {
> throw new RuntimeException()
> }
> ..
> ..
> }
Do you want && in that condition, not || ? I assume that your intent
is to throw the exception if save() fails. That is, in order to _not_
throw the exception the object needs to not have errors _and_ save
needs to succeed.
jb
--
Jeff Brown
SpringSource
http://www.springsource.com/
Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email