-->
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.  [ 7 posts ] 
Author Message
 Post subject: update only modified columns
PostPosted: Thu Sep 30, 2004 5:39 pm 
Newbie

Joined: Thu Sep 30, 2004 5:35 pm
Posts: 7
HI

I am fairly new to hibernate and this forum.
I have read about dynamic-update and used in one of my hbm.cfg file. But unfortunately the I am getting the full update SQL generated for all the columns. Part of config file is here:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>
<!--
Created by Middlegen Hibernate plugin

http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->

<class
name="com.rhi.extsites.shared.entity.cr.CandtEmpmtExper"
table="CANDT_EMPMT_EXPER"
dynamic-update="true"
dynamic-insert="true"
>

<id
name="candtEmpmtExperId"
type="java.lang.Long"
column="CANDT_EMPMT_EXPER_ID"
>
<generator class="assigned" />
</id>

<property
name="startDt"
type="java.util.Date"
column="START_DT"
length="10"
/>

2. Is there any way to show the SQL with parameter value on it. For eg, I used TopLink and I see the SQLs there with value being embedded, like "update table set field="Test""

Thanks for your help


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 30, 2004 5:49 pm 
Newbie

Joined: Thu Sep 30, 2004 5:35 pm
Posts: 7
I got the answer myself for the first one after reading more posts here. I issued a select-before-update and it worked. (though its not suggested because of performance reason.

Any help on question 2?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 01, 2004 2:28 pm 
Newbie

Joined: Sun May 02, 2004 2:52 pm
Posts: 5
venkatprakash wrote:
Any help on question 2?


Define a category(logger) in your log4j.xml:

Code:
<!--===================================-->
<!--### log JDBC bind parameters    ###-->
<category name="net.sf.hibernate.type">
    <priority value="DEBUG>
</category>

_________________
John Sampson


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 01, 2004 2:35 pm 
Newbie

Joined: Thu Sep 30, 2004 5:35 pm
Posts: 7
Well. Yes I did mention in my log4j.proeprties file like below
log4j.logger.net.sf.hibernate.type=DEBUG

and I do get bind values. My question is: is that possible to get the SQL with those values.

What currently showing is:
update table set field=?
binding "Y" to parameter 1

I would like to see :
update table set field="Y"

This is how TOPLink shows. Its very useful when we have table with large number of columns.

Thanks for your reply.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 01, 2004 2:42 pm 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
You can use http://www.p6spy.org/. It acts as a JDBC driver and logs exactyl what you are looking for.

HTH
Ernst


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 01, 2004 4:30 pm 
Newbie

Joined: Sun May 02, 2004 2:52 pm
Posts: 5
ernst_pluess wrote:
You can use http://www.p6spy.org/. It acts as a JDBC driver and logs exactyl what you are looking for.


Ernst is right. I've used IronEyesSql (whici is a GUI wrapped around the p6spy drver) with good results. http://www.irongrid.com/catalog/license_agreement2.php

_________________
John Sampson


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 02, 2004 2:34 pm 
Newbie

Joined: Thu Sep 30, 2004 5:35 pm
Posts: 7
jtsampson wrote:
ernst_pluess wrote:
You can use http://www.p6spy.org/. It acts as a JDBC driver and logs exactyl what you are looking for.


Ernst is right. I've used IronEyesSql (whici is a GUI wrapped around the p6spy drver) with good results. http://www.irongrid.com/catalog/license_agreement2.php


Thanks for your responses. Unfortunately I am not using any Application servers in this case. I am using Hibernate in our interfaces between 2 systems (databases). This has no front end tools. All are done through the back end interfaces.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.