Hi,

I have a requirement of updating some tables in my database on daily basis in bulk. There are 5-10 tables and collectively approximately 30,000 to 40,000 rows. To make update using ISIS I am using following approach.
First, I am fetching the record that I want to update using repository.
Then setting the value into returned domain object.

Here is the example:

User user = userRepository.findByCode("user1");
user.setName("username");
user.setEmail("[email protected]");
user.setCity("Mumbai");
...

(UserRepository class have a method findByCode("code") which then calls firstMatch() of RepositoryService to fetch a row)

Now, here is the problem.
With this approach, everytime I set a member of the object, an update query gets fired. So if I am updating a table with 20 columns, update query gets fired 20 times to update just one row. This process is very time consuming and tedious, if i have to update 1000s of rows. Is there any other way I can update tables more efficiently. I do not want to use SQL queries to update the data. I want to do it with ORM only.

Any suggestions??

--
Thanks,
Siddhesh Phatak

Reply via email to