I have the following object model definition:
Hibernate maps the relationship correctly, and the schema generated looks good too. However we running the FromController tests from AppFuse, I get the following:Code:protected Sector parent; /** * @return Returns the parent. * @hibernate.many-to-one * class = "uk.co.csspeople.model.Sector" * column = "parent" */ public Sector getParent() { return parent; }
I can't seem to find the documentation, but then I never liked manuals, to show how to do this kind of input binding. I was expecting that the test would supply null, no relationship end of... but that's not the way it seems to work. The DAOs and Managers test fine, just not the controller.Code:[junit] ------------- Standard Error ----------------- [junit] [Field error in object 'sector' on field 'parent': rejected value [n ull]; codes [typeMismatch.sector.parent,typeMismatch.parent,typeMismatch.uk.co.c sspeople.model.Sector,typeMismatch]; arguments [MessageSourceResolvable: codes [sector.parent,parent]; arguments []; default message [parent]]; default message [Failed to convert property value of type [java.lang.String] to required type [uk.co.csspeople.model.Sector] for property 'parent']] [junit] ------------- ---------------- --------------- [junit] Testcase: testSave(uk.co.csspeople.webapp.action.SectorFormControllerTest): FAILED
If not should I go back to my original idea and store the links as Long(s) and use the managers to retrieve related objects?
Any help would really be appreciated. Thank you in advance...


Reply With Quote