Announcement Announcement Module
No announcement yet.
Help for batch update Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help for batch update

    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 ?


  • #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.


    • #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.


      • #4
        In that case I think you should use plain SQL. The JdbcTemplate from spring makes this a very easy task.