Re: toMany relationship not fetched

From: Marcin Skladaniec (marci..sh.com.au)
Date: Thu Apr 13 2006 - 02:41:19 EDT

  • Next message: Andrus Adamchik: "Re: toMany relationship not fetched"

    Hello

    Yes, it is cayenne-1.2-dev-2006-4-11.
    I'm sorry that I can't provide more info, but there is no Exception
    thrown, the only symptom is that I'm getting a nulls where I should
    get data.
    I can add that I'm using an "wedge" class in between PersistentObject
    and client entity classes. (Client superclass on cayenne modeler form)

    I have a question too. Is it important to use same entity classes on
    client and server ?
    I would like not to import the client entity classes to server, but
    generate them separately. I'm using superclass and custom dotemplates
    what causes that whole client jar has to be added to server.
    Aren't those classes treated as beans, so there is no real need to
    have the same code on server and client ?

    Regards
    Marcin

    On 13/04/2006, at 4:22 PM, Andrus Adamchik wrote:

    > Hi Marcin,
    >
    > I'll look into that. Just to clarify, what version of Cayenne are
    > you using? Is this the latest nightly build?
    >
    > Andrus
    >
    >
    > On Apr 13, 2006, at 7:39 AM, Marcin Skladaniec wrote:
    >
    >> Hello everyone !
    >>
    >> Andrus, thank you for fixing that bug so quickly !
    >>
    >>
    >> I got another problem, it may be related to previous thats why I
    >> post it here.
    >>
    >> It does not happen always, I tried to create a separate project to
    >> reproduce it, but I couldn't.
    >>
    >> This is the code which reproduces problem in my application:
    >>
    >> CayenneContext context = ContextManager.getNewDedicatedContext();
    >> List students = context.performQuery(new SelectQuery
    >> (Student.class));
    >> for (int i=0 ; i<students.size();i++) {
    >> Student student = (Student)students.get(i);
    >>
    >> //this works ...
    >> logger.info(i+ ") students count = " +student.getLanguage
    >> ().getStudents().size());
    >>
    >> //this don't work
    >> logger.info(i+ ") language name = " +student.getLanguage
    >> ().getName());
    >> }
    >>
    >> CayenneContext context2 = ContextManager.getNewDedicatedContext
    >> ();
    >> List languages = context2.performQuery(new SelectQuery
    >> (Language.class));
    >> for (int i=0 ; i< languages.size();i++) {
    >> Language language = (Language)languages.get(i);
    >> if (language.getStudents().size() > 0) {
    >>
    >> logger.info(i+ ") language name = " +language.getName());
    >> logger.info(i+ ") students count = " +language.getStudents
    >> ().size());
    >>
    >> for (int j =0;j<language.getStudents().size();j++) {
    >> Student student = ((Student)language.getStudents().get(j));
    >> logger.info("\t"+j+ ") student name = " +student.getFullName
    >> ());
    >> logger.info("\t"+j+ ") student language = "
    >> +student.getLanguage().getName());
    >>
    >> }
    >> }
    >> }
    >>
    >> On output I'm getting :
    >>
    >> - 0) students count = 1
    >> - 0) language name = null
    >> - 1) students count = 1
    >> - 1) language name = null
    >> - 2) students count = 1
    >> - 2) language name = null
    >>
    >> - 8) language name = Galic
    >> - 8) students count = 1
    >> - 0) student name = test test
    >> - 0) student language = Galic
    >> - 1287) language name = Guatamalan
    >> - 1287) students count = 1
    >> - 0) student name = test2 test2
    >> - 0) student language = Guatamalan
    >> - 1509) language name = English
    >> - 1509) students count = 1
    >> - 0) student name = test3 test3
    >> - 0) student language = English
    >>
    >> It looks like sometimes the object is not "faulted" correctly. I
    >> can't see when and why ...
    >>
    >>
    >> Marcin
    >>
    >>
    >> On 11/04/2006, at 5:35 PM, Andrus Adamchik wrote:
    >>
    >>> Ok, now I got it. This is a bug - RelationshipQuery was
    >>> incorrectly intercepted by the client CayenneContext. I opened a
    >>> bug report:
    >>>
    >>> http://objectstyle.org/jira/browse/CAY-500
    >>>
    >>> and actually already checked in the fix, so it should be
    >>> available in 04/11 nightly build.
    >>>
    >>> Thanks
    >>> Andrus
    >>>
    >>>
    >>> On Apr 11, 2006, at 4:58 AM, Marcin Skladaniec wrote:
    >>>
    >>>
    >>
    >> -------------------------->
    >> ish
    >> http://www.ish.com.au
    >> Level 1, 30 Wilson Street Newtown 2042 Australia
    >> phone +61 2 9550 5001 fax +61 2 9550 4001
    >>
    >>
    >>
    >

    -------------------------->
    ish
    http://www.ish.com.au
    Level 1, 30 Wilson Street Newtown 2042 Australia
    phone +61 2 9550 5001 fax +61 2 9550 4001



    This archive was generated by hypermail 2.0.0 : Thu Apr 13 2006 - 02:41:45 EDT