Take a look at
http://www.datanucleus.org/products/datanucleus/jdo/query.html , "Bulk
Update" section.

You can use IsisJdoSupport#getPersistenceManager() to create a JDO Query
object to execute.

HTH
Dan

On Fri, 13 Oct 2017 at 11:19 Siddhesh Phatak <
siddhesh.pha...@idealattice.com> wrote:

> 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("u...@gmail.com");
> 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