-
Feb 16th, 2006, 11:59 AM
#1
Help for batch update
Hello,
This is probably a trivial question, but I really can't seem to find a sample. I am using Hibernate 2.1.3 and need to perform a simple query
"update tbl set flag='1' where date=?"
Can someone please point me to the location where I can find sample code for accomplishing this ?
Thanks
-
Feb 16th, 2006, 12:28 PM
#2
This is hibernate, not sql, so you have to "think in objects". First you retrieve a collection of the objects that map to you table, then you iterate over this collection, set the 'flag' attribute to 1 and save the object.
-
Feb 16th, 2006, 12:32 PM
#3
Kees, thanks for your reply. I already tried that and I think it is going out of memory, since there are about 20000 rows of data. Also, this is one step of a 5 step process (all 5 are batch processes), 2 of which are in a different datasource. And they all need to be in a single Jta transaction. Hence my problem.
-
Feb 16th, 2006, 12:45 PM
#4
In that case I think you should use plain SQL. The JdbcTemplate from spring makes this a very easy task.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules