dateCreated is updated after save an object obtained withNewSession

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

dateCreated is updated after save an object obtained withNewSession

diego.castro
Hi,

I'm working with grails 1.3.7 and I have an issue when an object obtained withNewSession is saved.

The dateCreated filed is updated to the current date.

This is my code:

def myDomainObject
  
DomainObject.withNewSession{
    myDomainObject =  DomainObject.createCriteria().get {
        eq 'id', 123456
    }
}

println myDomainObject.dump()

shp.save()

println myDomainObject.dump()

On the second println  dateCreated is updated to the current date.

However if I remove withNewSession the dateCreated is not updated as expected.

Do you have any clue about what is going on?

Thanks in advance.

Diego.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/46eb0d34-f448-4d79-af61-c701e3c4e62d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: dateCreated is updated after save an object obtained withNewSession

Jeff Brown
On September 22, 2016 at 2:39:34 PM, Diego Castro
([hidden email]) wrote:

> Hi,
>
> I'm working with grails 1.3.7 and I have an issue when an object obtained
> withNewSession is saved.
>
> The dateCreated filed is updated to the current date.
>
> This is my code:
>
> def myDomainObject
>
> DomainObject.withNewSession{
> myDomainObject = DomainObject.createCriteria().get {
> eq 'id', 123456
> }
> }
>
> println myDomainObject.dump()
>
> shp.save()
>
> println myDomainObject.dump()
>
> On the second println dateCreated is updated to the current date.
>
> However if I remove withNewSession the dateCreated is not updated as
> expected.
>
> Do you have any clue about what is going on?
>
> Thanks in advance.
>

That sounds like a bug.  It is very unlikely that a bug in 1.3.x will
ever be fixed at this point.  If the problem occurs in recent versions
of Grails we could investigate and fix it.



JSB

--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAEfmkrjPC%2B5007fvEecSRj26tw7gf7eQyo-HQQcovz76W73FCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...