-->
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.  [ 2 posts ] 
Author Message
 Post subject: SQL order for Update after flush
PostPosted: Thu Feb 18, 2010 7:09 am 
Newbie

Joined: Thu Feb 18, 2010 7:03 am
Posts: 1
Hello,

I have a question, i have a entity :
Person.

String Name
String FirstName.

I load object in session, I change only the Name with the setter and when the Session is flush the SQL order is :

Update Person set name = "", firstName ="" where id = "".

The firstName is changed too !

It's possible ta have a sql query like this (maybe a configuration of hibernate is needed ? ):

Update Person set name = "" where id = "".

Thanks


Top
 Profile  
 
 Post subject: Re: SQL order for Update after flush
PostPosted: Thu Feb 18, 2010 7:25 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
This can be reached by Dynamic SQL generation (Java Persistence with Hibernate, Chapter 4.3.1).

Code:
<class name="Person" dynamic-update="true>
...
</class>

alternatively with annotations:
Code:
@Entity
@org.hibernate.annotations.Entity( dynamicUpdate = true)
public class Person


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