Yes... this works... but... you are just moving the problem a little bit more far.
The goal I try to achieve is to define only in one place the Type (Long) of the id inside the Entity.
--> So if I change it to Integer or something else... I need to do only in one place ad don't have to refactor all my code.
I showed the code with the "EntityService"... but other layers of my application will have the same problem (DO, DTO, DO2DTOMapper, ...)
Anyway... thank for help.
Hope someone hass a good idea to fix this problem.