|
I haven't checked in Java, but my SQL logs show that GORM/Hibernate always updates the whole domain object and not only the fields/properties that have changed. Is it supposed to be that way?
It could be how I wrote my controller code, but I doubt it... Below is my SQL log when I update only 1 field...
Thanks
Fred
===============================
[groovy] Hibernate:
[groovy] update [groovy] officer [groovy] set [groovy] version=?, [groovy] name=?, [groovy] firstname=?, [groovy] homephone=?, [groovy] mobilephone=?, [groovy] email=?, [groovy] othernames=?, [groovy] streetnumber=?, [groovy] address=?, [groovy] suburb=?, [groovy] state=?, [groovy] postcode=?, [groovy] faxnumber=?, [groovy] license=?, [groovy] crowdcontrollicense=?, [groovy] investigatorlicense=?, [groovy] consultantlicense=?, [groovy] securitylevel=?, [groovy] crowdcontrollevel=?, [groovy] investigatorlevel=?, [groovy] consultantlevel=?, [groovy] securityexpiry=?, [groovy] crowdexpiry=?, [groovy] investigatorexpiry=?, [groovy] consultantexpiry=?, [groovy] certificateSO=?, [groovy] certificateCC=?, [groovy] certificateSI=?, [groovy] certificateSC=?, [groovy] bankname=?, [groovy] accountname=?, [groovy] bsbnumber=?, [groovy] accountnumber=?, [groovy] supername=?, [groovy] supernumber=?, [groovy] superaccountname=?, [groovy] supercontactname=?, [groovy] supercontactnumber=?, [groovy] taxfilenumber=?, [groovy] taxfreethreshold=?, [groovy] hecswithheld=?, [groovy] childsupport=?, [groovy] childsupportdetails=?, [groovy] baserate=?, [groovy] weekendrate=?, [groovy] holidayrate=?, [groovy] sex=?, [groovy] countryofbirth=?, [groovy] citizenresident=?, [groovy] visatype=?, [groovy] dateofbirth=?, [groovy] agreement=?, [groovy] agreementexpirydate=?, [groovy] driverlicenseclass=?, [groovy] driverlicensenumber=?, [groovy] driverlicenseexpiry=?, [groovy] firstaidsenior=?, [groovy] firstaidseniorexpiry=?, [groovy] firstaidoccupational=?, [groovy] firstaidoccupationalexpiry=?, [groovy] additionalskills=?, [groovy] kinsurname=?, [groovy] kinfirstname=?, [groovy] kinothernames=?, [groovy] kinrelation=?, [groovy] kindateofbirth=?, [groovy] kinstreetnumber=?, [groovy] kinaddress=?, [groovy] kinsuburb=?, [groovy] kinstate=?, [groovy] kinpostcode=?, [groovy] kinhomenumber=?, [groovy] kinmobilenumber=?, [groovy] kinworknumber=?, [groovy] employmenttype=?, [groovy] positionheld=?, [groovy] availibility=?, [groovy] probationsuccessful=?, [groovy] commencementdate=?, [groovy] probationcommenceddate=?, [groovy] probationreviewdate=?, [groovy] terminationdate=?, [groovy] terminationcomments=?, [groovy] archived=?, [groovy] inductionbookletreceived=?, [groovy] signoffsheetreceived=? [groovy] where [groovy] id=? [groovy] and version=? |
|
I think it's all handled by Hibernate. According to Hibernate people,
"updating only the changed columns of a table can be significantly faster for some databases but potentially slower for others". So maybe it's dependent on the actual SQL dialect... That's purely my guess. On 30/03/07, Fred Janon <[hidden email]> wrote: > I haven't checked in Java, but my SQL logs show that GORM/Hibernate always > updates the whole domain object and not only the fields/properties that have > changed. Is it supposed to be that way? > > It could be how I wrote my controller code, but I doubt it... Below is my > SQL log when I update only 1 field... > > Thanks > > Fred > > =============================== > [groovy] Hibernate: > [groovy] update > [groovy] officer > [groovy] set > [groovy] version=?, > [groovy] name=?, > [groovy] firstname=?, > [groovy] homephone=?, > [groovy] mobilephone=?, > [groovy] email=?, > [groovy] othernames=?, > [groovy] streetnumber=?, > [groovy] address=?, > [groovy] suburb=?, > [groovy] state=?, > [groovy] postcode=?, > [groovy] faxnumber=?, > [groovy] license=?, > [groovy] crowdcontrollicense=?, > [groovy] investigatorlicense=?, > [groovy] consultantlicense=?, > [groovy] securitylevel=?, > [groovy] crowdcontrollevel=?, > [groovy] investigatorlevel=?, > [groovy] consultantlevel=?, > [groovy] securityexpiry=?, > [groovy] crowdexpiry=?, > [groovy] investigatorexpiry=?, > [groovy] consultantexpiry=?, > [groovy] certificateSO=?, > [groovy] certificateCC=?, > [groovy] certificateSI=?, > [groovy] certificateSC=?, > [groovy] bankname=?, > [groovy] accountname=?, > [groovy] bsbnumber=?, > [groovy] accountnumber=?, > [groovy] supername=?, > [groovy] supernumber=?, > [groovy] superaccountname=?, > [groovy] supercontactname=?, > [groovy] supercontactnumber=?, > [groovy] taxfilenumber=?, > [groovy] taxfreethreshold=?, > [groovy] hecswithheld=?, > [groovy] childsupport=?, > [groovy] childsupportdetails=?, > [groovy] baserate=?, > [groovy] weekendrate=?, > [groovy] holidayrate=?, > [groovy] sex=?, > [groovy] countryofbirth=?, > [groovy] citizenresident=?, > [groovy] visatype=?, > [groovy] dateofbirth=?, > [groovy] agreement=?, > [groovy] agreementexpirydate=?, > [groovy] driverlicenseclass=?, > [groovy] driverlicensenumber=?, > [groovy] driverlicenseexpiry=?, > [groovy] firstaidsenior=?, > [groovy] firstaidseniorexpiry=?, > [groovy] firstaidoccupational=?, > [groovy] firstaidoccupationalexpiry=?, > [groovy] additionalskills=?, > [groovy] kinsurname=?, > [groovy] kinfirstname=?, > [groovy] kinothernames=?, > [groovy] kinrelation=?, > [groovy] kindateofbirth=?, > [groovy] kinstreetnumber=?, > [groovy] kinaddress=?, > [groovy] kinsuburb=?, > [groovy] kinstate=?, > [groovy] kinpostcode=?, > [groovy] kinhomenumber=?, > [groovy] kinmobilenumber=?, > [groovy] kinworknumber=?, > [groovy] employmenttype=?, > [groovy] positionheld=?, > [groovy] availibility=?, > [groovy] probationsuccessful=?, > [groovy] commencementdate=?, > [groovy] probationcommenceddate=?, > [groovy] probationreviewdate=?, > [groovy] terminationdate=?, > [groovy] terminationcomments=?, > [groovy] archived=?, > [groovy] inductionbookletreceived=?, > [groovy] signoffsheetreceived=? > [groovy] where > [groovy] id=? > [groovy] and version=? --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Fred Janon
Fred, That is standard hibernate behavior. If you write custom mapping
files you can tell hibernate to only update changed fields but then hibernate has to do a query first and compare by field to detect the changes (it doesn't simply go off the cache). I'm not sure how you would set this in grails since it uses hibernate's schema generation. Kalin Fred Janon wrote: > I haven't checked in Java, but my SQL logs show that GORM/Hibernate > always updates the whole domain object and not only the > fields/properties that have changed. Is it supposed to be that way? > > It could be how I wrote my controller code, but I doubt it... Below is > my SQL log when I update only 1 field... > > Thanks > > Fred > > =============================== > [groovy] Hibernate: > [groovy] update > [groovy] officer > [groovy] set > [groovy] version=?, > [groovy] name=?, > [groovy] firstname=?, > [groovy] homephone=?, > [groovy] mobilephone=?, > [groovy] email=?, > [groovy] othernames=?, > [groovy] streetnumber=?, > [groovy] address=?, > [groovy] suburb=?, > [groovy] state=?, > [groovy] postcode=?, > [groovy] faxnumber=?, > [groovy] license=?, > [groovy] crowdcontrollicense=?, > [groovy] investigatorlicense=?, > [groovy] consultantlicense=?, > [groovy] securitylevel=?, > [groovy] crowdcontrollevel=?, > [groovy] investigatorlevel=?, > [groovy] consultantlevel=?, > [groovy] securityexpiry=?, > [groovy] crowdexpiry=?, > [groovy] investigatorexpiry=?, > [groovy] consultantexpiry=?, > [groovy] certificateSO=?, > [groovy] certificateCC=?, > [groovy] certificateSI=?, > [groovy] certificateSC=?, > [groovy] bankname=?, > [groovy] accountname=?, > [groovy] bsbnumber=?, > [groovy] accountnumber=?, > [groovy] supername=?, > [groovy] supernumber=?, > [groovy] superaccountname=?, > [groovy] supercontactname=?, > [groovy] supercontactnumber=?, > [groovy] taxfilenumber=?, > [groovy] taxfreethreshold=?, > [groovy] hecswithheld=?, > [groovy] childsupport=?, > [groovy] childsupportdetails=?, > [groovy] baserate=?, > [groovy] weekendrate=?, > [groovy] holidayrate=?, > [groovy] sex=?, > [groovy] countryofbirth=?, > [groovy] citizenresident=?, > [groovy] visatype=?, > [groovy] dateofbirth=?, > [groovy] agreement=?, > [groovy] agreementexpirydate=?, > [groovy] driverlicenseclass=?, > [groovy] driverlicensenumber=?, > [groovy] driverlicenseexpiry=?, > [groovy] firstaidsenior=?, > [groovy] firstaidseniorexpiry=?, > [groovy] firstaidoccupational=?, > [groovy] firstaidoccupationalexpiry=?, > [groovy] additionalskills=?, > [groovy] kinsurname=?, > [groovy] kinfirstname=?, > [groovy] kinothernames=?, > [groovy] kinrelation=?, > [groovy] kindateofbirth=?, > [groovy] kinstreetnumber=?, > [groovy] kinaddress=?, > [groovy] kinsuburb=?, > [groovy] kinstate=?, > [groovy] kinpostcode=?, > [groovy] kinhomenumber=?, > [groovy] kinmobilenumber=?, > [groovy] kinworknumber=?, > [groovy] employmenttype=?, > [groovy] positionheld=?, > [groovy] availibility=?, > [groovy] probationsuccessful=?, > [groovy] commencementdate=?, > [groovy] probationcommenceddate=?, > [groovy] probationreviewdate=?, > [groovy] terminationdate=?, > [groovy] terminationcomments=?, > [groovy] archived=?, > [groovy] inductionbookletreceived=?, > [groovy] signoffsheetreceived=? > [groovy] where > [groovy] id=? > [groovy] and version=? --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Fred Janon
On a related issue, don't you think it might be a good idea to
refactor that class while you're at it? I mean damn that's a wide table and a lot of those items could be conceptually broken out into, and better handled by, other domain objects. -- - kate = masukomi http://weblog.masukomi.org/ --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
