It appears that in 1.1.4, list (and table) end up using toString to populate the table cells. I believe 1.1.3 was properly using converters. Is this a change in 1.1.4? What is the reasoning behind it?
It appears that in 1.1.4, list (and table) end up using toString to populate the table cells. I believe 1.1.3 was properly using converters. Is this a change in 1.1.4? What is the reasoning behind it?
Can you give us the steps to reproduce this please, and the details of what cells you are looking at on which screen?
Andrew, this is evident in the Pet Clinic sample. I ran the clinic.roo script to generate the application. Then, simply create an Owner and a Pet. Assigned the Owner to that Pet and go to List All Pets. In the Pets table, notice the Owner column. The values are "Address: ..." which is the representation built by the generated toString method. The converter builds a string in the form of "First Last ..."
faktor,
I had a similar problem when upgrading one project from Roo 1.1.3 to 1.1.4. Other projects I upgraded did not have the same problem though, I do not know why, I think it is because I have made changes to the domain finders and controllers in the project that was giving me problems. These changes I think updated the ApplicationConversionServiceFactoryBean_Roo_Conver sionService.aj file (this did not happen with the other projects but maybe future changes to these projects may cause a similra problem).
The conversions that were registered in the protected void installFormatters(FormatterRegistry registry) method in the ApplicationConversionServiceFactoryBean.java file that previously worked but were being ignored.
The ApplicationConversionServiceFactoryBean_Roo_Conver sionService.aj file had created new methods:
public void installLabelConverters(FormatterRegistry registry)
public void afterPropertiesSet()
and a converter class for each domain class.
I subsequently removed all my previous methods that were referred to in the protected void installFormatters(FormatterRegistry registry) method and added the newly created methods:
public void installLabelConverters(FormatterRegistry registry)
public void afterPropertiesSet() - using the @Override annotation on this method
and added the converter class for each domain class
from ApplicationConversionServiceFactoryBean_Roo_Conver sionService.aj file and updated the class converters according to my requirements.
This deleted the ApplicationConversionServiceFactoryBean_Roo_Conver sionService.aj file and everything worked as before. I am sure this is not the best solution but worked.
Hope this helps
I've replicated the problem in Roo 1.1.1 through 1.1.4 using the clinic.roo script (UPDATE: it's already logged as ROO-1861).
In 1.1.4 at least, the converter is correctly used in the "Create/Update/Show Pet" views, just not in the pet list views (as you noted above).
UPDATE: the problem is in the "table" tag used by the list views. If you change this line:
... to this:Code:<spring:eval expression="item[column]" var="colTxt"/>
... then it should work. Can you give this a try and let me know if it works for you too?Code:<c:set var="colTxt"> <spring:eval expression="item[column]" /> </c:set>
UPDATE: fix committed for the next release; you can manually apply the above workaround in the meantime if necessary.
Last edited by Andrew Swan; May 27th, 2011 at 01:27 AM. Reason: Added proposed fix