beforeinsert and beforeupdate called but not saving in database

View: New views
3 Messages — Rating Filter:   Alert me  

beforeinsert and beforeupdate called but not saving in database

by mjfan80 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi to all
i'm using grails 1.2m3
but this problem is the same with grails 1.1.1

this is my beforeinsert

def beforeInsert = {
                Date sqlDate = this.utilityService.getSqlDate()
                println "sono in beforeinsert del log, sqlDate= " + sqlDate
                this.dt =  DataOra.resettaOra(sqlDate)
                this.ora =  DataOra.resettaData(sqlDate)
                println "dt:" + this.dt + ", ora:" + this.ora
        }

when saving the domain class, the println are working well... i see everything i want...  but then, in the database, i see dt and ora = NULL

same stuff with beforeupdate

why?
what i'm missing?

Re: beforeinsert and beforeupdate called but not aving in database

by Robert Fischer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is your domain object failing to validate?

~~ Robert Fischer, Smokejumper IT Consulting.
Enfranchised Mind Blog http://EnfranchisedMind.com/blog

Grails Expert Retainer Services
http://smokejumperit.com/grails-retainer/


mjfan80 wrote:

> hi to all
> i'm using grails 1.2m3
> but this problem is the same with grails 1.1.1
>
> this is my beforeinsert
>
> def beforeInsert = {
>                 Date sqlDate = this.utilityService.getSqlDate()
>                 println "sono in beforeinsert del log, sqlDate= " + sqlDate
>                 this.dt =  DataOra.resettaOra(sqlDate)
>                 this.ora =  DataOra.resettaData(sqlDate)
>                 println "dt:" + this.dt + ", ora:" + this.ora
>         }
>
> when saving the domain class, the println are working well... i see
> evrything i want...  but then, in the database, i see dt and ora = NULL
>
> same stuff with beforeupdate
>
> why?
> what i'm missing?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: beforeinsert and beforeupdate called but not saving in database

by mjfan80 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ok
now is working
just did a grails clean and it's working
:-)