Get requestparam from after model mapping api objects to entity objects

Viewed 17

So I have used modelMapper to map model objects to entity objects and vice versa. I am trying to get a requestparam which is giving me hard time and I would appreciate some help.

This is the error I am getting:

Hibernate: select c1_0.id, c1_0.email, c1_0.first_name, c1_0.idp_customer_id, c1_0.last_name, c1_0.phone from customer_entity as c1_0 where c1_0.idp_customer_id = ? 2022-08-04 22:41:10 [http-nio-8040-exec-4] ERROR - [dispatcherServlet]:175: Servlet.service() for servlet [dispatcherServlet] in context with path [/ca] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: source cannot be null] with root cause java.lang.IllegalArgumentException: source cannot be null

This is my controller:

 /** GET request to return customer Id_id **/
    @RequestMapping( method = RequestMethod.GET)
    @ResponseBody
    public Customer getCustomerIdpId(@RequestParam(name = "idp_customer_id") String idpCustomerId) {
            return customerMapper.convertToCustomer(customerAccountService.getCustomerIdp(idpCustomerId));
    }

And this is my CustomerMapper:

 public Customer convertToCustomer(CustomerEntity customerEntity) {
    return  modelMapper.map(customerEntity, Customer.class);

}

my request body:

{
"idpCustomerId": "3940f85e-4601-4870-b30f-c6624e7d4678",}

Thank you.

0 Answers
Related