i have a question about annotation My Class:
@Override
@Transactional
public void process() {
. . .
send(persons);
}
public void send(List<person> persons) {
. . .
// person list size 1.000.0000
for(...){
update(persons); --> 1000, 1000 sending for loop
}
}
public void update(List<person> persons){
...
List<person> errorPersons;
...
persons.forEach(person-> {
person.setName("Google - " + person.getName());
});
persons.removeAll(errorPersons);
getSession().getTransaction().commit(); //--|
getSession().beginTransaction(); //--| > is works!
getSession().clear(); //--|
send(persons); //recursive
}
It works as follows. How can I do this with annotation?
getSession().getTransaction().commit(); //--|
getSession().beginTransaction(); //--| > is works!
getSession().clear();
I tried a few methods but it didn't work, can you help with this issue?
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void update(List<person> persons){
getSession().getTransaction().commit(); //--> Not Working
}
@Transactional(propagation = Propagation.REQUIRES)
public void update(List<person> persons){
getSession().getTransaction().commit(); //--> Not Working
}
I just want to do, how can I do this more optimized?