java - Why hibernate always call "update" statement after using "select" statement in MySQL? -


is there me in case. using hibernate select data db, when check sql debug log. see update sql printed after use "select" sql data db.

2013-08-13 13:39:08,054 debug [http-0.0.0.0-8080-1-task]-[org.hibernate.sql] select this_.id                                            id504_2_,     this_.bridgedlinedialoguri                          bridgedl2_504_2_,     this_.bridgedlineuri                                bridgedl3_504_2_,     this_.currentsipsubscriberprofile                   currents4_504_2_,     this_.currentsipsubscriberprofiletype               currents5_504_2_,     this_.messageeventuri                               messagee6_504_2_,     this_.nemobjectid                                   nemobjec7_504_2_,     this_.objectid                                      objectid504_2_,     this_.objecttype                                    objecttype504_2_,     this_.sipbridgedlineurienable                       sipbrid10_504_2_,     this_.sipdirectconnecturi                           sipdire11_504_2_,     this_.sipdirectconnecturienable                     sipdire12_504_2_,     this_.sipidentityaddress                            sipiden13_504_2_,     this_.sipidentitycontacturi                         sipiden14_504_2_,     this_.sipidentitypassword                           sipiden15_504_2_,     this_.sipidentityrealm                              sipiden16_504_2_,     this_.sipiotparametersenablestatus                  sipiotp17_504_2_,     this_.sipiotparametersprivacy                       sipiotp18_504_2_,     this_.sipiotparametersrequire100rel                 sipiotp19_504_2_,     this_.sipiotparameterssupport100rel                 sipiotp20_504_2_,     this_.sipmessageeventurienable                      sipmess21_504_2_,     this_.sippreferredid                                sippref22_504_2_,     this_.sippreferredidmode                            sippref23_504_2_,     this_.sipsubscribertemplateenable                   sipsubs24_504_2_,     this_.sipusername                                   sipuser25_504_2_,     this_.versipsubscriberprofile_id                    versips26_504_2_,     versioneds2_.id                                     id507_0_,     versioneds2_.configurationprofileid                 configur4_507_0_,     versioneds2_.description                            descript2_507_0_,     versioneds2_.version                                version507_0_,     configurat3_.id                                     id505_1_,     configurat3_.description                            descript2_505_1_,     configurat3_.name                                   name505_1_,     configurat3_.type                                   type505_1_,     profilemob4_.versionedsipsubscriberconfigprofile_id versione1_507_4_,     profilemob4_.element                                element4_   test this_     left outer join versionedsipsubscriberconfigprofile versioneds2_                     on this_.versipsubscriberprofile_id = versioneds2_.id     left outer join configurationprofile configurat3_                     on versioneds2_.configurationprofileid = configurat3_.id     left outer join versionedsipsubscriberconfigprofile_profilemobjectids                     profilemob4_                     on versioneds2_.id =                     profilemob4_.versionedsipsubscriberconfigprofile_id  this_.objectid = ?    2013-08-13 13:39:08,103 debug [http-0.0.0.0-8080-1-task]-[org.hibernate.sql]  update test set    bridgedlinedialoguri = ?,     bridgedlineuri = ?,     currentsipsubscriberprofile = ?,     currentsipsubscriberprofiletype = ?,     messageeventuri = ?,     nemobjectid = ?,     objectid = ?,     objecttype = ?,     sipbridgedlineurienable = ?,     sipdirectconnecturi = ?,     sipdirectconnecturienable = ?,     sipidentityaddress = ?,     sipidentitycontacturi = ?,     sipidentitypassword = ?,     sipidentityrealm = ?,     sipiotparametersenablestatus = ?,     sipiotparametersprivacy = ?,     sipiotparametersrequire100rel = ?,     sipiotparameterssupport100rel = ?,     sipmessageeventurienable = ?,     sippreferredid = ?,     sippreferredidmode = ?,     sipsubscribertemplateenable = ?,     sipusername = ?,     versipsubscriberprofile_id = ?  id = ?   

thanks

edit: code getting data:

 @override public mobjectid findresult(final mobjectid id, boolean islocked)  {      criteria c = getsession().createcriteria(test.class);      c.add(expression.eq("objectid", id));      if(islocked)     {        c.setlockmode("this", lockmode.upgrade);      }      test extension = (test) c.uniqueresult();      return (extension != null)       ? new mobjectid("/ontpotssipextnr=" + extension.getid())        : null;   }  

and entity class below:

@entity public class ontpotssipextension implements serializable {  private static final long serialversionuid = 1l;   @id @generatedvalue(strategy = generationtype.auto) private long id;  public ontpotssipextension() {  }  @column(unique = true, nullable = false) @type(type = "com.container.persistence.mobjectidusertype") private mobjectid objectid;  @column(unique = false, nullable = true) @type(type = "com.container.persistence.mobjecttypeusertype") private mobjecttype objecttype;  private toggleswitch sipsubscribertemplateenable = toggleswitch.disable;  @manytoone private versionedsipsubscriberconfigprofile versipsubscriberprofile = null;  @column(unique = false, nullable = true) @type(type = "com.container.persistence.mobjectidusertype") private mobjectid nemobjectid; private string sipidentityaddress; private string sipidentityrealm; private password sipidentitypassword; private string sipidentitycontacturi;  private string sipusername;  private toggleswitch sipdirectconnecturienable = toggleswitch.disable; @enabledexpression("sipdirectconnecturienable eq 'enable'") private string sipdirectconnecturi;  private toggleswitch sipmessageeventurienable = toggleswitch.disable; @enabledexpression("sipmessageeventurienable eq 'enable'") private string messageeventuri;  private toggleswitch sipbridgedlineurienable = toggleswitch.disable; @enabledexpression("sipbridgedlineurienable eq 'enable'") private string bridgedlineuri; @enabledexpression("sipbridgedlineurienable eq 'enable'") private string bridgedlinedialoguri;  @column(unique = false, nullable = true) @type(type = "com.container.persistence.mobjectidusertype") private mobjectid currentsipsubscriberprofile; @column(unique = false, nullable = true) @type(type = "com.container.persistence.mobjecttypeusertype") private mobjecttype currentsipsubscriberprofiletype; /* sip iot parameters*/ private privacysettings sipiotparametersprivacy = privacysettings.null; private toggleswitch sipiotparametersenablestatus = toggleswitch.enable; private toggleswitch sippreferredidmode = toggleswitch.disable; private string sippreferredid; private toggleswitch sipiotparameterssupport100rel = toggleswitch.disable ; private toggleswitch sipiotparametersrequire100rel = toggleswitch.disable;  public string getbridgedlinedialoguri() { return bridgedlinedialoguri; } public void setbridgedlinedialoguri(string bridgedlinedialoguri) { this.bridgedlinedialoguri = bridgedlinedialoguri; } public string getbridgedlineuri() { return bridgedlineuri; } public void setbridgedlineuri(string bridgedlineuri) { this.bridgedlineuri = bridgedlineuri; } public long getid() { return id; } public void setid(long id) { this.id = id; } public string getmessageeventuri() { return messageeventuri; } public void setmessageeventuri(string messageeventuri) { this.messageeventuri = messageeventuri; } public mobjectid getobjectid() { return objectid; } public void setobjectid(mobjectid objectid) { this.objectid = objectid; } public string getsipdirectconnecturi() { return sipdirectconnecturi; } public void setsipdirectconnecturi(string sipdirectconnecturi) { this.sipdirectconnecturi = sipdirectconnecturi; } public string getsipidentityaddress() { return sipidentityaddress; } public void setsipidentityaddress(string sipidentityaddress) { this.sipidentityaddress = sipidentityaddress; } public string getsipidentitycontacturi() { return sipidentitycontacturi; } public void setsipidentitycontacturi(string sipidentitycontacturi) { this.sipidentitycontacturi = sipidentitycontacturi; } public password getsipidentitypassword() { return sipidentitypassword; } public void setsipidentitypassword(password sipidentitypassword) { this.sipidentitypassword = sipidentitypassword; } public string getsipidentityrealm() { return sipidentityrealm; } public void setsipidentityrealm(string sipidentityrealm) { this.sipidentityrealm = sipidentityrealm; } public string getsipusername() { return sipusername; } public void setsipusername(string sipusername) { this.sipusername = sipusername; } public toggleswitch getsipsubscribertemplateenable() { return sipsubscribertemplateenable; } public void setsipsubscribertemplateenable( toggleswitch sipsubscribertemplateenable) { this.sipsubscribertemplateenable = sipsubscribertemplateenable; }  public versionedsipsubscriberconfigprofile getversipsubscriberprofile() { return versipsubscriberprofile; } public void setversipsubscriberprofile( versionedsipsubscriberconfigprofile versipsubscriberprofile) { this.versipsubscriberprofile = versipsubscriberprofile; //todo /* * needs done usage state changes deploy @ first * instance profile used */ //this.subscriberprofile.setusagestate( usagestate.usage_deploy ); } public toggleswitch getsipbridgedlineurienable() { return sipbridgedlineurienable; } public void setsipbridgedlineurienable(toggleswitch sipbridgedlineurienable) { this.sipbridgedlineurienable = sipbridgedlineurienable; } public toggleswitch getsipdirectconnecturienable() { return sipdirectconnecturienable; } public void setsipdirectconnecturienable(toggleswitch sipdirectconnecturienable) { this.sipdirectconnecturienable = sipdirectconnecturienable; } public toggleswitch getsipmessageeventurienable() { return sipmessageeventurienable; } public void setsipmessageeventurienable(toggleswitch sipmessageeventurienable) { this.sipmessageeventurienable = sipmessageeventurienable; } public mobjectid getnemobjectid() { return nemobjectid; } public void setnemobjectid(mobjectid nemobjectid) { this.nemobjectid = nemobjectid; } public mobjectid getcurrentsipsubscriberprofile() { return currentsipsubscriberprofile; } public void setcurrentsipsubscriberprofile(mobjectid currentsipsubscriberprofile) { this.currentsipsubscriberprofile = currentsipsubscriberprofile; } public mobjecttype getcurrentsipsubscriberprofiletype() { return currentsipsubscriberprofiletype; } public void setcurrentsipsubscriberprofiletype( mobjecttype currentsipsubscriberprofiletype) { this.currentsipsubscriberprofiletype = currentsipsubscriberprofiletype; } public mobjecttype getobjecttype() { return objecttype; } public void setobjecttype(mobjecttype objecttype) { this.objecttype = objecttype; } public privacysettings getsipiotparametersprivacy() { return sipiotparametersprivacy; } public void setsipiotparametersprivacy(privacysettings privacy) { this.sipiotparametersprivacy = privacy; } public toggleswitch getsipiotparametersenablestatus() { return sipiotparametersenablestatus; } public void setsipiotparametersenablestatus(toggleswitch sipiotparametersenablestatus) { this.sipiotparametersenablestatus = sipiotparametersenablestatus; } public toggleswitch getsipiotparameterssupport100rel() { return sipiotparameterssupport100rel; } public void setsipiotparameterssupport100rel(toggleswitch support100rel) { this.sipiotparameterssupport100rel = support100rel; } public toggleswitch getsipiotparametersrequire100rel() { return sipiotparametersrequire100rel; } public void setsipiotparametersrequire100rel(toggleswitch require100rel) { this.sipiotparametersrequire100rel = require100rel; } public toggleswitch getsippreferredidmode() { return sippreferredidmode; } public void setsippreferredidmode(toggleswitch sippreferredidmode) { this.sippreferredidmode = sippreferredidmode; } public string getsippreferredid() { return sippreferredid; } public void setsippreferredid(string sippreferredid) { this.sippreferredid = sippreferredid; } public properties getproperties(boolean enablesipiotparams) { string quotes= "\""; properties props = new properties();  props.setproperty("addressofrecord",quotes + ( getsipidentityaddress() != null ? getsipidentityaddress() : "" )+ quotes); props.setproperty("realm", quotes + ( getsipidentityrealm() != null ? getsipidentityrealm() : "" )+ quotes); props.setproperty("password", quotes + ( getsipidentitypassword() != null ? getsipidentitypassword().getpassword() : "" )+ quotes); props.setproperty("contacturiuser",quotes + ( getsipidentitycontacturi() != null ? getsipidentitycontacturi() : "" )+ quotes); props.setproperty("username",quotes + ( getsipusername() != null ? getsipusername() : "" )+ quotes); if ( getsipdirectconnecturienable() != null && getsipdirectconnecturienable().equals( toggleswitch.enable )) { props.setproperty("directconnecturi",quotes + ( getsipdirectconnecturi() != null ? getsipdirectconnecturi() : "" )+ quotes); } if ( getsipmessageeventurienable() != null && getsipmessageeventurienable().equals(toggleswitch.enable) ) { props.setproperty("message_event_uri",quotes + ( getmessageeventuri() != null ? getmessageeventuri() : "" )+ quotes); } if ( getsipbridgedlineurienable() != null && getsipbridgedlineurienable().equals( toggleswitch.enable ) ) { props.setproperty("bridged_line_uri",quotes + ( getbridgedlineuri() != null ? getbridgedlineuri() : "" )+ quotes); props.setproperty("bridged_line_dialog_uri",quotes + ( getbridgedlinedialoguri() != null ? getbridgedlinedialoguri() : "" )+ quotes); } if(enablesipiotparams && getsipiotparametersenablestatus() != null && getsipiotparametersenablestatus() == toggleswitch.enable ){  string privacy=""; if ( getsipiotparametersprivacy() != null) { if(getsipiotparametersprivacy() == privacysettings.id) privacy="id"; else if(getsipiotparametersprivacy() == privacysettings.none) privacy="none"; else if(getsipiotparametersprivacy() == privacysettings.null) privacy=""; }  props.setproperty("privacy", quotes + privacy + quotes); props.setproperty("support100rel", quotes + ( getsipiotparameterssupport100rel() != null ? getsipiotparameterssupport100rel().getvalue() : toggleswitch.disable.getvalue() )+ quotes); props.setproperty("require100rel", quotes + ( getsipiotparametersrequire100rel() != null ? getsipiotparametersrequire100rel().getvalue() : toggleswitch.disable.getvalue() )+ quotes); props.setproperty("mode", quotes + ( getsippreferredidmode() != null ? getsippreferredidmode().getvalue() : toggleswitch.disable.getvalue() ) + quotes); props.setproperty("id", quotes + ( getsippreferredid() != null ? getsippreferredid() : "" )+ quotes); }  //todo check // if ( sipsubscribertemplateenable != null && sipsubscribertemplateenable.equals(toggleswitch.enable) ) // { // properties templprops = subscriberprofile.getproperties(); // enumeration<?> propnames = templprops.propertynames(); // // while ( propnames.hasmoreelements() ) // { // object key = propnames.nextelement() ; // props.setproperty(key.tostring(), templprops.getproperty( key.tostring() )); // } // } return props; } } 

most probably, 1 of properties of entity not return exact same value set hibernate after loading. have if statements null handling or in getter or setter?


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -