I have the following scenario,
public void someEjbMethod1()
{
for (int i=0; i=10; i++)
{
em.merge(arr[i]);
em.flush();
}
}
I need to merge each object of (arr[i]
) separately. as the above code will commit all the arr[i]
instances at the end of the function.
I am thinking to do the following:
public void someEjbMethod1()
{
for (int i=0; i=10; i++)
{
saveObj(arr[i]);
}
}
// should I use a transaction attribute here??
public void saveObj(SomeObject obj)
{
em.merge(arr[i]);
em.flush();
}