I have an entity named "Specific" and an attribute named "specificType". I have a WOTextField bound to specific.specificType and a WOSubmitButton bound to saveChanges() all wrapped in a WOForm. When I run the component and click to save changes to the database, I get a NullPointerException. Have I instantiated the Specific entity and inserted it into an editing context correctly? Or do I have other problems?
public class SpecificEntry extends WOComponent { private Specific specific; private EOEditingContext ec = new EOEditingContext();
public SpecificEntry(WOContext context) { super(context); }
public Specific specific() { if (specific == null) { editingContext().revert();
specific = (Specific)EOUtilities.createAndInsertInstance(editingContext(), "Specific"); }
return specific; }
public WOComponent saveChanges() {
editingContext().saveChanges();
setSpecific(null);
return context().page(); }
public EOEditingContext editingContext() { return ec; }
public void setSpecific(Specific newSpecific) { specific = newSpecific; } }
Thanks, Awbrey
|