Friday, 20 July 2012

Disabling AutoSaving Of Object Into Database In Grails.

----------------------------------------------------------------

In Grails if we get object from database and change it's properties then the persistence context save that object to database.

This Condition would not applied for newly created object.

........................Solution.....................

discard

Purpose :- it discards changes that are made persistence.

def student =Student.get(1)student .name = "Ankit"
student.discard() // changes won't be applied now

Description

Discard is same as Hibernate's evict method .
Discard inform persistence that changes are not saved into the database.

  



No comments:

Post a Comment