Results 1 to 4 of 4

Thread: Help for batch update

  1. #1
    Join Date
    Jan 2006
    Posts
    20

    Default 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

  2. #2
    Join Date
    Dec 2004
    Location
    Rotterdam, The Netherlands
    Posts
    162

    Default

    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.
    Kees de Kooter
    www.boplicity.net

  3. #3
    Join Date
    Jan 2006
    Posts
    20

    Default

    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. #4
    Join Date
    Dec 2004
    Location
    Rotterdam, The Netherlands
    Posts
    162

    Default

    In that case I think you should use plain SQL. The JdbcTemplate from spring makes this a very easy task.
    Kees de Kooter
    www.boplicity.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •