Using converters in a list with Spring Roo
Now that I found how to use converters in an HTML SELECT in Spring Roo, I am trying to do the same in a list.
I managed to register a Converter in my ApplicationConversionServiceFactoryBean, but now I need to use it as well when displaying a list of my envities. I have the following entity :
@RooJavaBean
@RooToString
@RooEntity
public class Environment {
@NotNull
@Size(min = 2, max = 30)
private String name;
@ManyToOne
private Application application;
}
W开发者_运维技巧hen displaying it as a list in the generated MVC, it looks like the application is displayed as a toString() and not using the registered converter.
What am I missing ?
You need to push-in refactor the Roo generated converter method to the application conversion factory bean.
Sometimes, by default toString()
method is used for the conversion.
Alternatively, you can try pushing in and overriding the toString()
method within the entity itself. You will have to remove the @RooToString
annotation while doing this.
Cheers!!!
精彩评论