Announcement Announcement Module
Collapse
No announcement yet.
Problem when Binding a subclass property Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem when Binding a subclass property

    Hi,

    I have a class Room which constains an embeddable class Dimension. The class has some properties like hight, width, depth.

    I binded the formModel for Room with

    Code:
    TableFormBuilder formBuilder = new TableFormBuilder(getBindingFactory());
    TableLayoutBuilder layoutBuilder = formBuilder.getLayoutBuilder();
    SwingBindingFactory sbf = new SwingBindingFactory(getFormModel());
    Binding hight = sbf.createBoundTextField("dimension.hight");
    Binding width = sbf.createBoundTextField("dimension.width");
    Binding depth = sbf.createBoundTextField("dimension.depth");
    Now:
    - if I open a Room object with a dimension it is ok, I see the dimensions.
    - if I open (the first time) a Room with dimension null, I got an error, which is understable.
    - But if I first open an Room with dimension and then a Room without I keep seeing the dimessions of the first room, I didn't get an error.

    For me it seems logic to get an error too, but it would be nice if the TextField could be set to null because the parent doesn't exist.

    I had this error because I use Hibernate and I have an embeddable object. When I read a record an if the Dimession is not set Hibernate returns me a null for the Dimension, which is logic.

    I can deal with it by check in my Bean if the Dimession is null create a new one and it works but it is not nice.

    Any other Idea? Or should we change the Binding behavior?

    Regards
    Dominique
Working...
X