Hi,
I have another Question about Cayenne Quick Start > Tapestry Tutorial.
I got it running and all the pages worked fine except:
AddPaintingPage gives this error:
org.apache.tapestry.BindingException
Parameter value (0) is an instance of java.math.BigDecimal, which does not
inherit from java.lang.String.
binding: ExpressionBinding[AddPaintingPage painting.estimatedPrice]
location: context:/WEB-INF/pages/AddPaintingPage.page, line 21, column
64
I believe is because the TextField implements String and can't bind directly
to the BigDecimal Type of painting.estimatedPrice.
I had to change the following:
AddPaintingPage.java
public void pageBeginRender(PageEvent event) {
Painting painting = new Painting();
painting.setEstimatedPrice(new BigDecimal(0));
setPainting(painting);
}
TO
public void pageBeginRender(PageEvent event) {
Painting painting = new Painting();
painting.setEstimatedPrice("0");
setPainting(painting);
}
I also had to change the generated class file from Cayenne:
public void setEstimatedPrice(java.math.BigDecimal estimatedPrice) {
writeProperty("estimatedPrice", estimatedPrice);
}
public java.math.BigDecimal getEstimatedPrice() {
return (java.math.BigDecimal)readProperty("estimatedPrice");
TO
public void setEstimatedPrice(String estimatedPrice) {
writeProperty("estimatedPrice", estimatedPrice);
}
public String getEstimatedPrice() {
return readProperty("estimatedPrice").toString();
}
After I changed those above I could run the whole example with no problems.
My question is that the generated class says:
/** Class _Painting was generated by Cayenne.
* It is probably a good idea to avoid changing this class manually,
* since it may be overwritten next time code is regenerated.
* If you need to make any customizations, please use subclass.
*/
I thought about overriding the method in the Painting class that extends
_Painting, but it doesn't allow that with return types not matching.
Where would I make this change without worrying about my changes being
overwritten by Cayenne?
Thank you for your help.
Michael
This archive was generated by hypermail 2.0.0 : Thu Feb 10 2005 - 20:55:14 EST