Thread error #30125
-
I am trying to get the AbsenceType-Object using the "findById(long id).await().indefinitely()" method to pass it on my Employee object. Unfortunately I get this error message: I guess this error message occured because is not possible to perform a Blockin-Action in a Non-Blocking Method. @ReactiveTransactional
@Override
public Uni<Notification> createNotification(Notification notification) {
AbsenceType absenceType = absenceTypeService.findById(0l).await().indefinitely();
return employeeService.getCurrentEmp()
.chain(employee -> {
notification.setEmployee(employee);
notification.setAbsenceType(absenceType);
return notification.persistAndFlush();
});
} **QEUSTION:** How i get the absenceType-Object and set it in the "chain"-Method of "getCurrentEmp()"? I have already tried this: @ReactiveTransactional
@Override
public Uni<Notification> createNotification(Notification notification) {
Uni<AbsenceType> absenceTypeUni = absenceTypeService.findById(Long.valueOf(1));
absenceTypeUni.chain(absenceType -> {
notification.setAbsenceType(absenceType);
return notification.persistAndFlush();
});
return employeeService.getCurrentEmp()
.chain(employee -> {
notification.setEmployee(employee);
// TODO: solve this problem
return notification.persistAndFlush();
});
} But the "absenceType"-Value is always "null" when i get the List of Notifications. Can somebody shows me the right way? Thanks 🙏🏽 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I SOLVED IT @ReactiveTransactional
@Override
public Uni<Notification> createNotification(Notification notification) {
return employeeService.getCurrentEmp()
.chain(employee -> {
notification.setEmployee(employee);
return absenceTypeService.<AbsenceType>findById(0l);
}).onItem().transformToUni(item -> {
notification.setAbsenceType(item);
return notification.persistAndFlush();
});
} |
Beta Was this translation helpful? Give feedback.
I SOLVED IT