I am trying to make a custom JSF converter for my category model. The value I get from the field and to the converter is an category id. Should I retrieve the category by that ID, and return that object? I have tried injecting an entitymanager but that did not work, since it is not managed. I was able to find a post where a guy did it, but I don't know if it is usual to inject entitymanagers into converters.
Or should I override the toString method in the Category class, and return a string such as
2, "long description"
and then use the toString as value in the fields. When I want it back to an object I split it and use the setters on the category object. I have not worked with converters before so I don't know if this is any better?