问题
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;
}
When 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 ?
回答1:
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!!!
来源:https://stackoverflow.com/questions/6664258/using-converters-in-a-list-with-spring-roo