B
B
Bonce2021-12-08 23:51:38
Java
Bonce, 2021-12-08 23:51:38

Is it possible to Fetch a remote entity within a single transaction?

There is something like this

@Transactional(propagation = REQUIRES_NEW)
String remove(Long id) {
   NodeEntity node = nodeRepository.findById(id);
   nodeRepository.delete(node);
   return node.getType().getName();
}

Where

class NodeEntity {
...
   @ManyToOne(fetch = LAZY)
    private TypeEntity type;
}


Won't an exception be thrown or a long fetch executed in the delete service method?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question