-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Why hibernate always call “update” statement?
PostPosted: Tue Aug 13, 2013 7:00 am 
Newbie

Joined: Tue Aug 13, 2013 6:55 am
Posts: 3
Is there anybody help me in this case. I am using hibernate for select data from db, but when I check from sql debug log. I always see the update sql printed after I use "select" sql to get data from DB.

2013-08-13 13:39:08,054 DEBUG [http-0.0.0.0-8080-1-TASK]-[org.hibernate.SQL] select this_.id as id504_2_, this_.bridgedLineDialogUri as bridgedL2_504_2_, this_.bridgedLineUri as bridgedL3_504_2_, this_.currentSipSubscriberProfile as currentS4_504_2_, this_.currentSipSubscriberProfileType as currentS5_504_2_, this_.messageEventUri as messageE6_504_2_, this_.neMobjectId as neMobjec7_504_2_, this_.objectId as objectId504_2_, this_.objectType as objectType504_2_, this_.sipBridgedLineUriEnable as sipBrid10_504_2_, this_.sipDirectConnectUri as sipDire11_504_2_, this_.sipDirectConnectUriEnable as sipDire12_504_2_, this_.sipIdentityAddress as sipIden13_504_2_, this_.sipIdentityContactURI as sipIden14_504_2_, this_.sipIdentityPassword as sipIden15_504_2_, this_.sipIdentityRealm as sipIden16_504_2_, this_.sipIotParametersEnableStatus as sipIotP17_504_2_, this_.sipIotParametersPrivacy as sipIotP18_504_2_, this_.sipIotParametersRequire100Rel as sipIotP19_504_2_, this_.sipIotParametersSupport100Rel as sipIotP20_504_2_, this_.sipMessageEventUriEnable as sipMess21_504_2_, this_.sipPreferredID as sipPref22_504_2_, this_.sipPreferredIDMode as sipPref23_504_2_, this_.sipSubscriberTemplateEnable as sipSubs24_504_2_, this_.sipUsername as sipUser25_504_2_, this_.verSipSubscriberProfile_id as verSipS26_504_2_, versioneds2_.id as id507_0_, versioneds2_.configurationProfileId as configur4_507_0_, versioneds2_.description as descript2_507_0_, versioneds2_.version as version507_0_, configurat3_.id as id505_1_, configurat3_.description as descript2_505_1_, configurat3_.name as name505_1_, configurat3_.type as type505_1_, profilemob4_.VersionedSipSubscriberConfigProfile_id as Versione1_507_4_, profilemob4_.element as element4_ from 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 where 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=? where id=?

Thanks


Top
 Profile  
 
 Post subject: Re: Why hibernate always call “update” statement?
PostPosted: Tue Aug 13, 2013 7:49 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
Your entity classes would be a great help.


Top
 Profile  
 
 Post subject: Re: Why hibernate always call “update” statement?
PostPosted: Tue Aug 13, 2013 1:25 pm 
Newbie

Joined: Tue Aug 13, 2013 6:55 am
Posts: 3
Below is my entity class:

@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
/*
* This needs to be done so that the Usage State changes to DEPLOY at the first
* instance this profile is 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 this
// 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;
}
}


Top
 Profile  
 
 Post subject: Re: Why hibernate always call “update” statement?
PostPosted: Wed Aug 14, 2013 6:02 am 
Newbie

Joined: Tue Aug 13, 2013 6:55 am
Posts: 3
When I turn on dynamicUpdate = true, I see the field was updated as below:

2013-08-14 16:24:38,163 DEBUG [RMI TCP Connection(9)-192.168.95.114]-[org.hibernate.SQL] update VoIPExtension set currentSipClientProfileType=?, currentSipSubscriberProfileType=? where id=?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.