I'm having a problem and I cannot find a solution for it. This problem is making me sick for the past few days. This is the model I use:
When I call the next function from the browser, it prints null. The reason why is that Spring does not understand that a UitlegOnderdeelHTML is also a UitlegOnderdeel (which is abstract).Code:@Entity @RooEntity @RooJavaBean @Inheritance(strategy = InheritanceType.JOINED) public abstract class UitlegOnderdeel { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") protected Long id; /** * Titel van het onderdeel */ @NotNull protected String naam; } @Entity @RooEntity @RooJavaBean public class UitlegOnderdeelHTML extends UitlegOnderdeel { @Lob String content; @Override public UitlegType getType() { return UitlegType.HTML; } }
I have tried several things, like custom validation, type casting, but they all do not work since Spring does not bind the form to the formObject parameter.Code:@Transactional @RequestMapping(value = "/admin/uitlegonderdeel/{onderwerpid}/form", method = RequestMethod.POST) public String create(@PathVariable("onderwerpid") Long onderwerpId, UitlegOnderdeel formObject, BindingResult result, ModelMap modelMap) { System.out.println(formObject); ... }
I am looking for a generic solution where I can use the method above (in some way) to bind several subclasses of UitlegOnderdeel. SpringMVC3 is used.
-BasilFX


Reply With Quote