FAQ
I'm using (jgoodies) binding as a sync mechanism between my view and
model (cayenne objects) so what I basically do is:
A a = new A();
// bind the model (a) to the UI

When I need to replace the initial (empty) model with a new (empty)
model or a committed model, I simply set the new model to the new or
committed model and the bindings remain in place.

However, I now have two beans representing the model and have tried to
do the following:
A a = new A();
B b = new B();
a.setToB(b);
// bind a and b to the UI

The setToB call, however, throws a NPE.

It's possible that I wouldn't be facing this problem if I registered
the objects with the DataContext, but I'd rather not if there's a way:
the above approach worked well so far.

I register the objects with the DataContext once their properties have
been properly edited and validated and the object itself is added to a
list of valid objects. It seemed to make sense to me that I can build
an object graph, register it's objects with the DataContext and then
simply commit or rollback the changes. It seems that my first
assumption was flawed.
Could someone please enlighten me on the subject?

TIA,
t.n.a.

Search Discussions

  • Andrus Adamchik at Nov 25, 2006 at 5:06 pm
    Yeah, at the moment for the relationships to work, objects have to be
    registered with DataContext. In 3.0 we will likely be working on ways
    to "attach" unregistered graphs to the DataContext, but as of now
    this feature is not there yet.

    Andrus
    On Nov 25, 2006, at 10:44 AM, Tomi NA wrote:

    I'm using (jgoodies) binding as a sync mechanism between my view and
    model (cayenne objects) so what I basically do is:
    A a = new A();
    // bind the model (a) to the UI

    When I need to replace the initial (empty) model with a new (empty)
    model or a committed model, I simply set the new model to the new or
    committed model and the bindings remain in place.

    However, I now have two beans representing the model and have tried to
    do the following:
    A a = new A();
    B b = new B();
    a.setToB(b);
    // bind a and b to the UI

    The setToB call, however, throws a NPE.

    It's possible that I wouldn't be facing this problem if I registered
    the objects with the DataContext, but I'd rather not if there's a way:
    the above approach worked well so far.

    I register the objects with the DataContext once their properties have
    been properly edited and validated and the object itself is added to a
    list of valid objects. It seemed to make sense to me that I can build
    an object graph, register it's objects with the DataContext and then
    simply commit or rollback the changes. It seems that my first
    assumption was flawed.
    Could someone please enlighten me on the subject?

    TIA,
    t.n.a.
  • Tomi NA at Nov 25, 2006 at 6:05 pm

    2006/11/25, Andrus Adamchik <andrus@objectstyle.org>:
    Yeah, at the moment for the relationships to work, objects have to be
    registered with DataContext. In 3.0 we will likely be working on ways
    to "attach" unregistered graphs to the DataContext, but as of now
    this feature is not there yet.
    It is now Saturday afternoon (in Croatia, anyway) and I happen to have
    a bad case of the common cold, so I thought I might use the peace and
    quiet at home to do a bit more work on an important project. I run
    into a problem and ask for help and on a Saturday afternoon I get a
    reply no more than an hour and a half after I posted my questions...
    ...this mailing list brings together, by far, the most helpful and
    patient group of people I had the privilege to be a member of, with
    Andrus leading the way! Thank you, everyone!

    ...don't let it go to your heads. :)

    Cheers,
    Tomislav
  • Andrus Adamchik at Nov 25, 2006 at 6:36 pm
    Yeah, sometimes quiet Saturday afternoons is the only time left to
    hack Cayenne :-)

    Andrus

    On Nov 25, 2006, at 1:05 PM, Tomi NA wrote:

    2006/11/25, Andrus Adamchik <andrus@objectstyle.org>:
    Yeah, at the moment for the relationships to work, objects have to be
    registered with DataContext. In 3.0 we will likely be working on ways
    to "attach" unregistered graphs to the DataContext, but as of now
    this feature is not there yet.
    It is now Saturday afternoon (in Croatia, anyway) and I happen to have
    a bad case of the common cold, so I thought I might use the peace and
    quiet at home to do a bit more work on an important project. I run
    into a problem and ask for help and on a Saturday afternoon I get a
    reply no more than an hour and a half after I posted my questions...
    ...this mailing list brings together, by far, the most helpful and
    patient group of people I had the privilege to be a member of, with
    Andrus leading the way! Thank you, everyone!

    ...don't let it go to your heads. :)

    Cheers,
    Tomislav

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedNov 25, '06 at 3:45p
activeNov 25, '06 at 6:36p
posts4
users2
websitecayenne.apache.org

2 users in discussion

Andrus Adamchik: 2 posts Tomi NA: 2 posts

People

Translate

site design / logo © 2022 Grokbase