Get email of table in other table relationship "Many to many" and "one to many" spring boot

Viewed 11

enter image description here

when i want to call email from table contacte in ProductService PRProduct manytomany BuAffiliate OneToMany BUContact i use this methode

 Product.getAffiliate().stream()
                .map(contact ->{
                    IdBO idBO3 = new IdBO();
                    idBO3.setId(contact.getId());
                    return  contactService.getAllContactsByAffiliate(idBO3); })
                .forEach(mail  -> notificationProcessor.sendEmailWithParams(mail, notificationSender));

when i want to call email from table contacte in ProductService PRProduct OneToMany BuAffiliate OneToMany BUContact i use this methode

 //oneToMany



    Product.getAffiliate().stream()
                        .map(contact ->{
                            IdBO idBO1 = new IdBO();
                            idBO1.setId(contact.getId());
                            return   contactService.getById(idBO1.getId()).getEmail(); })
                      .forEach(mail  -> notificationProcessor.sendEmailWithParams(mail, notificationSender));

but is not work i dont know why ??

0 Answers
Related