Skip to content
Advertisement

I can not mapped Model and DTO could not execute statement; SQL [n/a] constraint [null]

This is base person entity it extends baseEntity which has only Id Auto creament

JavaScript

This is location Entity which also extends base entity

JavaScript

Now I want to save peron entity which includes location table id also

JavaScript

My PostMan Request is below

JavaScript

My Service class is below

JavaScript

Advertisement

Answer

This is not the correct way to do this. You are mapping your PersonDTO to the Person class. But their location variable has completely different types. One is a Location and the other a long.

The correct way to do this would be to change the PersonDTO class like this:

JavaScript

And then, make a postman request this way:

JavaScript

Make sure that the names and variable types are the same…

Good luck!

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement