You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2006/04/08 12:34:35 UTC

Re: toMany relationship not fetched

Marcin,

I ported your test to B1 and ran it on my machine - it works without  
any errors. Can you confirm whether this is still a problem?

BTW, I noticed one minor thing in the mapping - you should not  
populate "Client Superclass" field. This field is for the "wedge"  
class that may optionally be inserted in the inheritance hierarchy  
between cayenne.Persistent and _MyObject.

Andrus


On Mar 28, 2006, at 2:49 AM, Marcin Skladaniec wrote:

> Hello
> I tried with cayenne 1.2M12 but have the same problem.
> Here is a small project based on the 3t example from sandbox
> reproducing the malfunction I'm seeing. (http:// 
> smokidwa.freeshell.org/work/test.zip)
> all jars needed to run project are on http://smokidwa.freeshell.org/ 
> work/
> Marcin
>
> On 27/03/2006, at 5:56 PM, Tore Halset wrote:
>
>> On Mar 19, 2006, at 23:48, Marcin Skladaniec wrote:
>>
>>> I created a brand new project and I'm still having this problem.  
>>> Double-checked out the relations, the data types are matching.
>>> I have done some more testing and found that one-to-many and many- 
>>> to-many flattened relations work. That is only many-to-one that  
>>> not works.
>>> What else can be wrong ?
>>
>> Can you create a small test-project to reproduce this behaviour?  
>> It will make it easier for us to help out.
>>
>>  - Tore.
>
> -------------------------->
> ish
> http://www.ish.com.au
> Level 1, 30 Wilson Street Newtown 2042 Australia
> phone +61 2 9550 5001   fax +61 2 9550 4001
>
>
>


Re: toMany relationship not fetched

Posted by Robert Zeigler <ro...@puregumption.com>.
When I get a chance, I'll grab the most recent nightly build and see if
the problem was resolved by CAY-503.
Sorry... didn't read Marcin's e-mail close enough the first time to
catch that his issue was with client side stuff.

Robert

Andrus Adamchik wrote:
> BTW, Robert's problem may be related to a recently fixed CAY-503:
>
> http://objectstyle.org/jira/browse/CAY-503
>
> Andrus
>
> On Apr 13, 2006, at 10:42 AM, Andrus Adamchik wrote:
>
>> Hi Robert,
>>
>> Although the causes of client-side CayenneContext problems are likely
>> different from the server-side DataContext, this part of the stack
>> was reworked recently as well, so there may be glitches. Please
>> provide more info when you have a chance. In the meantime I'll
>> include extra diagnostics in the exception message.
>>
>> Andrus
>>
>>
>> On Apr 13, 2006, at 9:08 AM, Robert Zeigler wrote:
>>
>>> Interesting...I also had faulting issues with 1.2B1. (past tense
>>> because
>>> I needed a fix very fast; so I downgraded back to M5, which is what I
>>> was using before).  The error I was getting wasn't a "toMany"
>>> relationship, though. But, the behavior there was also a bit
>>> stochastic... sometimes it worked, and sometimes it didn't; in May,
>>> things will be in more of a position for myself (and also for the
>>> company using the software) to where I can dig deeper into this. In the
>>> meanwhile, this is the exception I was getting:
>>>
>>> org.objectstyle.cayenne.FaultFailureException
>>> [v.1.2B1 April 6 2006] Error resolving fault, no matching row exists in
>>> the database for ObjectId: <ObjectId:AssignmentParameters,
>>> assignmentid=1590>
>>> unlabeledMessage:     Error resolving fault, no matching row exists
>>> in the
>>> database for ObjectId: <ObjectId:AssignmentParameters,
>>> assignmentid=1590>
>>> Stack Trace:
>>>
>>>     *
>>> org.objectstyle.cayenne.access.DataContext.prepareForAccess(DataContext.java:1742)
>>>
>>>
>>>     *
>>> org.objectstyle.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:238)
>>>
>>>
>>>     *
>>> org.eledge.domain.auto._AssignmentParameters.getPermitInvalidTransactions(_AssignmentParameters.java:68)
>>>
>>>
>>>     * org.eledge.domain.Assignment.assignmentDoable(Assignment.java:49)
>>>     *
>>> org.eledge.components.AssignmentTransactionCreator.doTransaction(AssignmentTransactionCreator.java:23)
>>>
>>>
>>>     *
>>> org.eledge.pages.ViewAssignment.activateExternalPage(ViewAssignment.java:32)
>>>
>>>
>>
>


Re: toMany relationship not fetched

Posted by Andrus Adamchik <an...@objectstyle.org>.
BTW, Robert's problem may be related to a recently fixed CAY-503:

http://objectstyle.org/jira/browse/CAY-503

Andrus

On Apr 13, 2006, at 10:42 AM, Andrus Adamchik wrote:

> Hi Robert,
>
> Although the causes of client-side CayenneContext problems are  
> likely different from the server-side DataContext, this part of the  
> stack was reworked recently as well, so there may be glitches.  
> Please provide more info when you have a chance. In the meantime  
> I'll include extra diagnostics in the exception message.
>
> Andrus
>
>
> On Apr 13, 2006, at 9:08 AM, Robert Zeigler wrote:
>
>> Interesting...I also had faulting issues with 1.2B1. (past tense  
>> because
>> I needed a fix very fast; so I downgraded back to M5, which is what I
>> was using before).  The error I was getting wasn't a "toMany"
>> relationship, though. But, the behavior there was also a bit
>> stochastic... sometimes it worked, and sometimes it didn't; in May,
>> things will be in more of a position for myself (and also for the
>> company using the software) to where I can dig deeper into this.  
>> In the
>> meanwhile, this is the exception I was getting:
>>
>> org.objectstyle.cayenne.FaultFailureException
>> [v.1.2B1 April 6 2006] Error resolving fault, no matching row  
>> exists in
>> the database for ObjectId: <ObjectId:AssignmentParameters,
>> assignmentid=1590>
>> unlabeledMessage: 	Error resolving fault, no matching row exists  
>> in the
>> database for ObjectId: <ObjectId:AssignmentParameters,  
>> assignmentid=1590>
>> Stack Trace:
>>
>>     * org.objectstyle.cayenne.access.DataContext.prepareForAccess 
>> (DataContext.java:1742)
>>
>>     * org.objectstyle.cayenne.CayenneDataObject.readProperty 
>> (CayenneDataObject.java:238)
>>
>>     *  
>> org.eledge.domain.auto._AssignmentParameters.getPermitInvalidTransact 
>> ions(_AssignmentParameters.java:68)
>>
>>     * org.eledge.domain.Assignment.assignmentDoable 
>> (Assignment.java:49)
>>     *  
>> org.eledge.components.AssignmentTransactionCreator.doTransaction 
>> (AssignmentTransactionCreator.java:23)
>>
>>     * org.eledge.pages.ViewAssignment.activateExternalPage 
>> (ViewAssignment.java:32)
>>
>


Re: toMany relationship not fetched

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Robert,

Although the causes of client-side CayenneContext problems are likely  
different from the server-side DataContext, this part of the stack  
was reworked recently as well, so there may be glitches. Please  
provide more info when you have a chance. In the meantime I'll  
include extra diagnostics in the exception message.

Andrus


On Apr 13, 2006, at 9:08 AM, Robert Zeigler wrote:

> Interesting...I also had faulting issues with 1.2B1. (past tense  
> because
> I needed a fix very fast; so I downgraded back to M5, which is what I
> was using before).  The error I was getting wasn't a "toMany"
> relationship, though. But, the behavior there was also a bit
> stochastic... sometimes it worked, and sometimes it didn't; in May,
> things will be in more of a position for myself (and also for the
> company using the software) to where I can dig deeper into this. In  
> the
> meanwhile, this is the exception I was getting:
>
> org.objectstyle.cayenne.FaultFailureException
> [v.1.2B1 April 6 2006] Error resolving fault, no matching row  
> exists in
> the database for ObjectId: <ObjectId:AssignmentParameters,
> assignmentid=1590>
> unlabeledMessage: 	Error resolving fault, no matching row exists in  
> the
> database for ObjectId: <ObjectId:AssignmentParameters,  
> assignmentid=1590>
> Stack Trace:
>
>     * org.objectstyle.cayenne.access.DataContext.prepareForAccess 
> (DataContext.java:1742)
>
>     * org.objectstyle.cayenne.CayenneDataObject.readProperty 
> (CayenneDataObject.java:238)
>
>     *  
> org.eledge.domain.auto._AssignmentParameters.getPermitInvalidTransacti 
> ons(_AssignmentParameters.java:68)
>
>     * org.eledge.domain.Assignment.assignmentDoable(Assignment.java: 
> 49)
>     *  
> org.eledge.components.AssignmentTransactionCreator.doTransaction 
> (AssignmentTransactionCreator.java:23)
>
>     * org.eledge.pages.ViewAssignment.activateExternalPage 
> (ViewAssignment.java:32)
>

Re: toMany relationship not fetched

Posted by Robert Zeigler <ro...@puregumption.com>.
Interesting...I also had faulting issues with 1.2B1. (past tense because
I needed a fix very fast; so I downgraded back to M5, which is what I
was using before).  The error I was getting wasn't a "toMany"
relationship, though. But, the behavior there was also a bit
stochastic... sometimes it worked, and sometimes it didn't; in May,
things will be in more of a position for myself (and also for the
company using the software) to where I can dig deeper into this. In the
meanwhile, this is the exception I was getting:

org.objectstyle.cayenne.FaultFailureException
[v.1.2B1 April 6 2006] Error resolving fault, no matching row exists in
the database for ObjectId: <ObjectId:AssignmentParameters,
assignmentid=1590>
unlabeledMessage: 	Error resolving fault, no matching row exists in the
database for ObjectId: <ObjectId:AssignmentParameters, assignmentid=1590>
Stack Trace:

    * org.objectstyle.cayenne.access.DataContext.prepareForAccess(DataContext.java:1742)

    * org.objectstyle.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:238)

    * org.eledge.domain.auto._AssignmentParameters.getPermitInvalidTransactions(_AssignmentParameters.java:68)

    * org.eledge.domain.Assignment.assignmentDoable(Assignment.java:49)
    * org.eledge.components.AssignmentTransactionCreator.doTransaction(AssignmentTransactionCreator.java:23)

    * org.eledge.pages.ViewAssignment.activateExternalPage(ViewAssignment.java:32)

    * org.apache.tapestry.engine.ExternalService.service(ExternalService.java:161)

    * org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:889)

    * org.eledge.EledgeEngine.service(EledgeEngine.java:60)
    * org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:198)

    * org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:159)

    * javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    * javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    * org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

    * org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

    * org.eledge.OldEledgePagesFilter.doFilter(OldEledgePagesFilter.java:64)

    * org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)

    * org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

    * org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)

    * org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

    * org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

    * org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    * org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)

    * org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

    * org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

    * org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    * org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)

    * org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

    * org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

    * org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)

    * org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

    * org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)

    * org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

    * org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)

    * org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)

    * org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

    * org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    * org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

    * org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)

    * org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)

    * org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    * org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:429)

    *

    * org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:495)
    * java.lang.Thread.run(Thread.java:534)



I double checked, and there all of the relationships are correct in the
db (and, despite what the exception says, there is a row in
AssignmentParameters with the assignmentid FK of 1590).

Line 49 of Assignment.java looks like:

            if
(this.getParameters().getPermitInvalidTransactions().booleanValue()) {

Line 68 of _AssignmentParameters.java looks like:

        return (Boolean)readProperty("permitInvalidTransactions");

I'll look into this deeper, like I said, probably at the beginning of
May... I didn't mention it before since I haven't had time to check if
it was a a "me" issue or a "cayenne" issue. But th fact that other
people seem to be having some trouble with fault resolving suggests that
it's not a "me issue", so I thought I'd add what little information I
have atm.

Robert

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
>
>


Re: toMany relationship not fetched

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Apr 26, 2006, at 11:53 AM, Andrus Adamchik wrote:

>
> On Apr 26, 2006, at 11:51 AM, Marcin Skladaniec wrote:
>
>> It looks like the Language object is in HOLLOW state but does not  
>> know about it. So we forced the state of Language to HOLLOW and  
>> everything works fine. Is there any way for related object to be  
>> in a wrong state because of localObject ?
>
> I think you are onto something here. I am testing this now.
>
> Andrus

Now I am able to reproduce the problem. Looks like it has something  
to do with the server-side object cache state, rather than the use of  
'localObject'. I'll open a Jira issue (when Jira comes up - it is  
currently down) and work on fixing it. Watch the dev list for the bug  
email.

Andrus

Re: toMany relationship not fetched

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Apr 26, 2006, at 11:51 AM, Marcin Skladaniec wrote:

> It looks like the Language object is in HOLLOW state but does not  
> know about it. So we forced the state of Language to HOLLOW and  
> everything works fine. Is there any way for related object to be in  
> a wrong state because of localObject ?

I think you are onto something here. I am testing this now.

Andrus


Re: toMany relationship not fetched

Posted by Marcin Skladaniec <ma...@ish.com.au>.
Hello
We found a workaround for the second problem.

On 26/04/2006, at 5:12 PM, Marcin Skladaniec wrote:

> Hi !
> I found small temporary solution to my problem.
> (I forgot to mention that we are using nightly build from 25.IV )
>
> On 26/04/2006, at 2:55 PM, Marcin Skladaniec wrote:
>
>> Andrus
>>
>> You mentioned once :
>>
>>> BTW, I noticed one minor thing in the mapping - you should not  
>>> populate "Client Superclass" field. This field is for the "wedge"  
>>> class that may optionally be inserted in the inheritance  
>>> hierarchy between cayenne.Persistent and _MyObject.
>>
>> We are using "wedge" classes for both client and server (that is  
>> between _clientEntity and PersistentObject, and as well between  
>> _serverEntity and CayenneDataObject. Is it all right ?
>>
>>
>> I have another problem which might be related. This is a short  
>> description:
>>
>> Student someStudent =
>> ...
>> Student student =  context.localObject(someStudent, null) ;
>>
>> logger.info( student.getLanguage() );
>> prints :
>> <com.ish.angel.cayenne.Language@4409132, id=<ObjectId:Language,  
>> id=1648>, state=committed,  
>> context=org.objectstyle.cayenne.CayenneContext@bc8f01>
>>
>> which is correct. But the problem is that
>>
>> logger.info( "Number of students speaking "+student.getLanguage 
>> ().getName() +" language : "+student.getLanguage().getStudents 
>> ().size() );
>> prints:
>> Number of students speaking null language : 2
>>
>> So the language record is not correct. It looks like the "simple"  
>> value (name) is missing while the related value (students) is  
>> correct !
>> There is no exception thrown. Could having the "wedge" class cause  
>> object to be not serialized properly ? Could it cause the problem  
>> which I described before in this thread ?

It looks like the Language object is in HOLLOW state but does not  
know about it. So we forced the state of Language to HOLLOW and  
everything works fine. Is there any way for related object to be in a  
wrong state because of localObject ?


>>
>> I just explain that the "wedge" classes are important to us, on  
>> client side we are using them as a simple triggers (to have simple  
>> validation happen before anything goes to server), we have  
>> getValueForKey / setValueForKey / getDataTypeForKey methods  
>> (implemented in dotemplates).
>> Having to remove those classes from project is not impossible, but  
>> would require some hard work. Please advise us if using those  
>> classes is right, or if you rather not recommend using them. Thank  
>> you !
>>
>> Marcin
>>
>>
>> On 26/04/2006, at 12:47 PM, Marcin Skladaniec wrote:
>>
>>> Hello !
>>>
>>> I'm still trying to fix committing problem I have. I think that  
>>> is it something in my code, but I cant find out what. Can someone  
>>> suggest what can be wrong ?
>>>
>>> I have two related objects in context, one is new, and one is  
>>> hollow (because it was copied to this context using localObject() ):
>>>
>>> 2006-04-26 12:05:46,172 [AWT-EventQueue-0] INFO   
>>> com.ish.angel.controller.EditController  - attempting to commit,  
>>> listing all objects in context:
>>> 2006-04-26 12:05:46,173 [AWT-EventQueue-0] INFO   
>>> com.ish.angel.controller.EditController  - 1  
>>> object :<com.ish.angel.cayenne.SubCategory@15880424,  
>>> id=<ObjectId:SubCategory, TEMP:000000F1D0423EC5>, state=new,  
>>> context=org.objectstyle.cayenne.CayenneContext@aaa10>
>>> 2006-04-26 12:05:46,173 [AWT-EventQueue-0] INFO   
>>> com.ish.angel.controller.EditController  - 2  
>>> object :<com.ish.angel.cayenne.Category@10349001,  
>>> id=<ObjectId:Category, id=200>, state=hollow,  
>>> context=org.objectstyle.cayenne.CayenneContext@aaa10>
>
> Here the one of the object is hollow - thats because it is just  
> recently localObject() was called on it. This causes the problem  
> with committing. It looks like after accessing any of the fields  
> with getters and changing persistence state to commited there is no  
> problem with commiting whole context.
>
>>>
>>> commitChanges() throws an exception:
>>>
>>> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2- 
>>> dev-2006-4-25 April 25 2006] Remote error. URL - http://localhost: 
>>> 8181/angel-server-cayenne
>>>         at  
>>> org.objectstyle.cayenne.remote.hessian.HessianConnection.doSendMessa 
>>> ge(HessianConnection.java:181)
>>>         at  
>>> org.objectstyle.cayenne.remote.BaseConnection.sendMessage 
>>> (BaseConnection.java:109)
>>>         at org.objectstyle.cayenne.remote.ClientChannel.send 
>>> (ClientChannel.java:279)
>>>         at org.objectstyle.cayenne.remote.ClientChannel.onSync 
>>> (ClientChannel.java:188)
>>>         at org.objectstyle.cayenne.CayenneContext.doCommitChanges 
>>> (CayenneContext.java:233)
>>>         at org.objectstyle.cayenne.CayenneContext.commitChanges 
>>> (CayenneContext.java:220)
>>>         at com.ish.angel.controller.EditController.saveRecord 
>>> (EditController.java:287)
>>>
>>> on server side there is an exception thrown too:
>>>
>>> 2006-04-26 12:05:46,240 [SocketListener0-1] DEBUG  
>>> com.ish.angel.server.cayenne.glue.CayenneDataObject  - Changing  
>>> persistence state for class  
>>> com.ish.angel.server.cayenne.SubCategory from: transient to: new
>>> Apr 26, 2006 12:05:46 PM  
>>> com.caucho.hessian.server.HessianSkeleton invoke
>>> WARNING: java.lang.NullPointerException
>>> java.lang.NullPointerException
>>>         at  
>>> org.objectstyle.cayenne.map.EntityResolver.lookupObjEntity 
>>> (EntityResolver.java:514)
>>> 2006-04-26 12:05:46,640 [SocketListener0-1] DEBUG  
>>> com.ish.angel.server.cayenne.glue.CayenneDataObject  - Changing  
>>> persistence state for class  
>>> com.ish.angel.server.cayenne.SubCategory from: transient to:  
>>> transient
>>>         at  
>>> org.objectstyle.cayenne.access.ChildDiffLoader.arcCreated 
>>> (ChildDiffLoader.java:141)
>>>         at org.objectstyle.cayenne.graph.ArcCreateOperation.apply 
>>> (ArcCreateOperation.java:80)
>>>         at org.objectstyle.cayenne.graph.CompoundDiff.apply 
>>> (CompoundDiff.java:133)
>>>         at  
>>> org.objectstyle.cayenne.access.DataContext.onContextFlush 
>>> (DataContext.java:1171)
>>>         at  
>>> org.objectstyle.cayenne.access.ClientServerChannel.onCommit 
>>> (ClientServerChannel.java:195)
>>>         at  
>>> org.objectstyle.cayenne.access.ClientServerChannel.onSync 
>>> (ClientServerChannel.java:147)
>>>         at  
>>> org.objectstyle.cayenne.remote.service.DispatchHelper.dispatch 
>>> (DispatchHelper.java:80)
>>>         at  
>>> org.objectstyle.cayenne.remote.service.BaseRemoteService.processMess 
>>> age(BaseRemoteService.java:182)
>>>         at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown  
>>> Source)
>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
>>> (DelegatingMethodAccessorImpl.java:25)
>>>         at java.lang.reflect.Method.invoke(Method.java:324)
>>>         at com.caucho.hessian.server.HessianSkeleton.invoke 
>>> (HessianSkeleton.java:157)
>>>         at  
>>> org.objectstyle.cayenne.remote.hessian.service._HessianServlet.servi 
>>> ce(_HessianServlet.java:388)
>>>         at com.ish.angel.server.CayenneServlet.service 
>>> (CayenneServlet.java:59)
>>>         at org.mortbay.jetty.servlet.ServletHolder.handle 
>>> (ServletHolder.java:428)
>>>         at org.mortbay.jetty.servlet.ServletHandler.dispatch 
>>> (ServletHandler.java:666)
>>>         at org.mortbay.jetty.servlet.ServletHandler.handle 
>>> (ServletHandler.java:568)
>>>         at org.mortbay.http.HttpContext.handle(HttpContext.java: 
>>> 1530)
>>>         at org.mortbay.http.HttpContext.handle(HttpContext.java: 
>>> 1482)
>>>         at org.mortbay.http.HttpServer.service(HttpServer.java:909)
>>>         at org.mortbay.http.HttpConnection.service 
>>> (HttpConnection.java:816)
>>>         at org.mortbay.http.HttpConnection.handleNext 
>>> (HttpConnection.java:982)
>>>         at org.mortbay.http.HttpConnection.handle 
>>> (HttpConnection.java:833)
>>>         at org.mortbay.http.SocketListener.handleConnection 
>>> (SocketListener.java:244)
>>>         at org.mortbay.util.ThreadedServer.handle 
>>> (ThreadedServer.java:357)
>>>         at org.mortbay.util.ThreadPool$PoolThread.run 
>>> (ThreadPool.java:534)
>>>
>>> I followed the stack trace. There is a call to
>>>
>>>         DataObject source = findObject(nodeId);
>>>
>>> 	which calls :
>>> 	
>>> 	graphManager.getNode(nodeId);
>>>
>>> in  ChildDiffLoader. In my case it appears to return null. (I  
>>> cant access cvs to put more logging into it to be 100% sure). Why  
>>> getNode() returns null ? Could that be because ObjectId has  
>>> already changed from TEMP id to permanent id ? (nodeId is  
>>> actually ObjectId, isn't it ?)
>>>
>>> Andrus, can you explain how is creating new object on server  
>>> processed ? I can see that after committing a new record on  
>>> server side this object is in transient state, and then it is  
>>> inserted to some context (transient -> new). Is that caused by  
>>> the exception that my object is then still in transient state ?
>>>
>>> Thank you
>>> Marcin
>>>
>>>
>>> -------------------------->
>>> 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
>>
>>
>
> -------------------------->
> 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



Re: toMany relationship not fetched

Posted by Marcin Skladaniec <ma...@ish.com.au>.
Hi !
I found small temporary solution to my problem.
(I forgot to mention that we are using nightly build from 25.IV )

On 26/04/2006, at 2:55 PM, Marcin Skladaniec wrote:

> Andrus
>
> You mentioned once :
>
>> BTW, I noticed one minor thing in the mapping - you should not  
>> populate "Client Superclass" field. This field is for the "wedge"  
>> class that may optionally be inserted in the inheritance hierarchy  
>> between cayenne.Persistent and _MyObject.
>
> We are using "wedge" classes for both client and server (that is  
> between _clientEntity and PersistentObject, and as well between  
> _serverEntity and CayenneDataObject. Is it all right ?
>
>
> I have another problem which might be related. This is a short  
> description:
>
> Student someStudent =
> ...
> Student student =  context.localObject(someStudent, null) ;
>
> logger.info( student.getLanguage() );
> prints :
> <com.ish.angel.cayenne.Language@4409132, id=<ObjectId:Language,  
> id=1648>, state=committed,  
> context=org.objectstyle.cayenne.CayenneContext@bc8f01>
>
> which is correct. But the problem is that
>
> logger.info( "Number of students speaking "+student.getLanguage 
> ().getName() +" language : "+student.getLanguage().getStudents 
> ().size() );
> prints:
> Number of students speaking null language : 2
>
> So the language record is not correct. It looks like the "simple"  
> value (name) is missing while the related value (students) is  
> correct !
> There is no exception thrown. Could having the "wedge" class cause  
> object to be not serialized properly ? Could it cause the problem  
> which I described before in this thread ?
>
> I just explain that the "wedge" classes are important to us, on  
> client side we are using them as a simple triggers (to have simple  
> validation happen before anything goes to server), we have  
> getValueForKey / setValueForKey / getDataTypeForKey methods  
> (implemented in dotemplates).
> Having to remove those classes from project is not impossible, but  
> would require some hard work. Please advise us if using those  
> classes is right, or if you rather not recommend using them. Thank  
> you !
>
> Marcin
>
>
> On 26/04/2006, at 12:47 PM, Marcin Skladaniec wrote:
>
>> Hello !
>>
>> I'm still trying to fix committing problem I have. I think that is  
>> it something in my code, but I cant find out what. Can someone  
>> suggest what can be wrong ?
>>
>> I have two related objects in context, one is new, and one is  
>> hollow (because it was copied to this context using localObject() ):
>>
>> 2006-04-26 12:05:46,172 [AWT-EventQueue-0] INFO   
>> com.ish.angel.controller.EditController  - attempting to commit,  
>> listing all objects in context:
>> 2006-04-26 12:05:46,173 [AWT-EventQueue-0] INFO   
>> com.ish.angel.controller.EditController  - 1  
>> object :<com.ish.angel.cayenne.SubCategory@15880424,  
>> id=<ObjectId:SubCategory, TEMP:000000F1D0423EC5>, state=new,  
>> context=org.objectstyle.cayenne.CayenneContext@aaa10>
>> 2006-04-26 12:05:46,173 [AWT-EventQueue-0] INFO   
>> com.ish.angel.controller.EditController  - 2  
>> object :<com.ish.angel.cayenne.Category@10349001,  
>> id=<ObjectId:Category, id=200>, state=hollow,  
>> context=org.objectstyle.cayenne.CayenneContext@aaa10>

Here the one of the object is hollow - thats because it is just  
recently localObject() was called on it. This causes the problem with  
committing. It looks like after accessing any of the fields with  
getters and changing persistence state to commited there is no  
problem with commiting whole context.

>>
>> commitChanges() throws an exception:
>>
>> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2- 
>> dev-2006-4-25 April 25 2006] Remote error. URL - http://localhost: 
>> 8181/angel-server-cayenne
>>         at  
>> org.objectstyle.cayenne.remote.hessian.HessianConnection.doSendMessag 
>> e(HessianConnection.java:181)
>>         at  
>> org.objectstyle.cayenne.remote.BaseConnection.sendMessage 
>> (BaseConnection.java:109)
>>         at org.objectstyle.cayenne.remote.ClientChannel.send 
>> (ClientChannel.java:279)
>>         at org.objectstyle.cayenne.remote.ClientChannel.onSync 
>> (ClientChannel.java:188)
>>         at org.objectstyle.cayenne.CayenneContext.doCommitChanges 
>> (CayenneContext.java:233)
>>         at org.objectstyle.cayenne.CayenneContext.commitChanges 
>> (CayenneContext.java:220)
>>         at com.ish.angel.controller.EditController.saveRecord 
>> (EditController.java:287)
>>
>> on server side there is an exception thrown too:
>>
>> 2006-04-26 12:05:46,240 [SocketListener0-1] DEBUG  
>> com.ish.angel.server.cayenne.glue.CayenneDataObject  - Changing  
>> persistence state for class  
>> com.ish.angel.server.cayenne.SubCategory from: transient to: new
>> Apr 26, 2006 12:05:46 PM com.caucho.hessian.server.HessianSkeleton  
>> invoke
>> WARNING: java.lang.NullPointerException
>> java.lang.NullPointerException
>>         at  
>> org.objectstyle.cayenne.map.EntityResolver.lookupObjEntity 
>> (EntityResolver.java:514)
>> 2006-04-26 12:05:46,640 [SocketListener0-1] DEBUG  
>> com.ish.angel.server.cayenne.glue.CayenneDataObject  - Changing  
>> persistence state for class  
>> com.ish.angel.server.cayenne.SubCategory from: transient to:  
>> transient
>>         at  
>> org.objectstyle.cayenne.access.ChildDiffLoader.arcCreated 
>> (ChildDiffLoader.java:141)
>>         at org.objectstyle.cayenne.graph.ArcCreateOperation.apply 
>> (ArcCreateOperation.java:80)
>>         at org.objectstyle.cayenne.graph.CompoundDiff.apply 
>> (CompoundDiff.java:133)
>>         at  
>> org.objectstyle.cayenne.access.DataContext.onContextFlush 
>> (DataContext.java:1171)
>>         at  
>> org.objectstyle.cayenne.access.ClientServerChannel.onCommit 
>> (ClientServerChannel.java:195)
>>         at  
>> org.objectstyle.cayenne.access.ClientServerChannel.onSync 
>> (ClientServerChannel.java:147)
>>         at  
>> org.objectstyle.cayenne.remote.service.DispatchHelper.dispatch 
>> (DispatchHelper.java:80)
>>         at  
>> org.objectstyle.cayenne.remote.service.BaseRemoteService.processMessa 
>> ge(BaseRemoteService.java:182)
>>         at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown  
>> Source)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
>> (DelegatingMethodAccessorImpl.java:25)
>>         at java.lang.reflect.Method.invoke(Method.java:324)
>>         at com.caucho.hessian.server.HessianSkeleton.invoke 
>> (HessianSkeleton.java:157)
>>         at  
>> org.objectstyle.cayenne.remote.hessian.service._HessianServlet.servic 
>> e(_HessianServlet.java:388)
>>         at com.ish.angel.server.CayenneServlet.service 
>> (CayenneServlet.java:59)
>>         at org.mortbay.jetty.servlet.ServletHolder.handle 
>> (ServletHolder.java:428)
>>         at org.mortbay.jetty.servlet.ServletHandler.dispatch 
>> (ServletHandler.java:666)
>>         at org.mortbay.jetty.servlet.ServletHandler.handle 
>> (ServletHandler.java:568)
>>         at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
>>         at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>>         at org.mortbay.http.HttpServer.service(HttpServer.java:909)
>>         at org.mortbay.http.HttpConnection.service 
>> (HttpConnection.java:816)
>>         at org.mortbay.http.HttpConnection.handleNext 
>> (HttpConnection.java:982)
>>         at org.mortbay.http.HttpConnection.handle 
>> (HttpConnection.java:833)
>>         at org.mortbay.http.SocketListener.handleConnection 
>> (SocketListener.java:244)
>>         at org.mortbay.util.ThreadedServer.handle 
>> (ThreadedServer.java:357)
>>         at org.mortbay.util.ThreadPool$PoolThread.run 
>> (ThreadPool.java:534)
>>
>> I followed the stack trace. There is a call to
>>
>>         DataObject source = findObject(nodeId);
>>
>> 	which calls :
>> 	
>> 	graphManager.getNode(nodeId);
>>
>> in  ChildDiffLoader. In my case it appears to return null. (I cant  
>> access cvs to put more logging into it to be 100% sure). Why  
>> getNode() returns null ? Could that be because ObjectId has  
>> already changed from TEMP id to permanent id ? (nodeId is actually  
>> ObjectId, isn't it ?)
>>
>> Andrus, can you explain how is creating new object on server  
>> processed ? I can see that after committing a new record on server  
>> side this object is in transient state, and then it is inserted to  
>> some context (transient -> new). Is that caused by the exception  
>> that my object is then still in transient state ?
>>
>> Thank you
>> Marcin
>>
>>
>> -------------------------->
>> 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
>
>

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



Re: How to express "column is null"

Posted by Mike Kienenberger <mk...@gmail.com>.
On 4/26/06, I. Venuti <i....@caribel.it> wrote:
> I'm trying to use an expression where I impose the condition "column is
> null".
> I've tried:
>
>  exp.setOperand( Expression.EXIST, "id_news");
>
> but it doesn't seem to work.

exp = ExpressionFactory.matchExp("id_news", null)

Something like the form below would help you avoid hardcoding model names.

exp = ExpressionFactory.matchExp(YourObjEntity.ID_NEWS_PROPERTY, null)

How to express "column is null"

Posted by "I. Venuti" <i....@caribel.it>.
Hi,

I'm trying to use an expression where I impose the condition "column is 
null".
I've tried:

 exp.setOperand( Expression.EXIST, "id_news");

but it doesn't seem to work.
Thanks

-- Ivan
>

Re: toMany relationship not fetched

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Apr 26, 2006, at 8:55 AM, Marcin Skladaniec wrote:

> I just explain that the "wedge" classes are important to us, on  
> client side we are using them as a simple triggers (to have simple  
> validation happen before anything goes to server), we have  
> getValueForKey / setValueForKey / getDataTypeForKey methods  
> (implemented in dotemplates).
> Having to remove those classes from project is not impossible, but  
> would require some hard work. Please advise us if using those  
> classes is right, or if you rather not recommend using them. Thank  
> you !

You should be able to use the wedge class. I just tried it with 3t  
example and it works just fine. Must be something else. I'll dig a  
some more on my end and take a look at your other error.

Andrus


Re: toMany relationship not fetched

Posted by Marcin Skladaniec <ma...@ish.com.au>.
Andrus

You mentioned once :

> BTW, I noticed one minor thing in the mapping - you should not  
> populate "Client Superclass" field. This field is for the "wedge"  
> class that may optionally be inserted in the inheritance hierarchy  
> between cayenne.Persistent and _MyObject.

We are using "wedge" classes for both client and server (that is  
between _clientEntity and PersistentObject, and as well between  
_serverEntity and CayenneDataObject. Is it all right ?


I have another problem which might be related. This is a short  
description:

Student someStudent =
...
Student student =  context.localObject(someStudent, null) ;

logger.info( student.getLanguage() );
prints :
<com.ish.angel.cayenne.Language@4409132, id=<ObjectId:Language,  
id=1648>, state=committed,  
context=org.objectstyle.cayenne.CayenneContext@bc8f01>

which is correct. But the problem is that

logger.info( "Number of students speaking "+student.getLanguage 
().getName() +" language : "+student.getLanguage().getStudents().size 
() );
prints:
Number of students speaking null language : 2

So the language record is not correct. It looks like the "simple"  
value (name) is missing while the related value (students) is correct !
There is no exception thrown. Could having the "wedge" class cause  
object to be not serialized properly ? Could it cause the problem  
which I described before in this thread ?

I just explain that the "wedge" classes are important to us, on  
client side we are using them as a simple triggers (to have simple  
validation happen before anything goes to server), we have  
getValueForKey / setValueForKey / getDataTypeForKey methods  
(implemented in dotemplates).
Having to remove those classes from project is not impossible, but  
would require some hard work. Please advise us if using those classes  
is right, or if you rather not recommend using them. Thank you !

Marcin


On 26/04/2006, at 12:47 PM, Marcin Skladaniec wrote:

> Hello !
>
> I'm still trying to fix committing problem I have. I think that is  
> it something in my code, but I cant find out what. Can someone  
> suggest what can be wrong ?
>
> I have two related objects in context, one is new, and one is  
> hollow (because it was copied to this context using localObject() ):
>
> 2006-04-26 12:05:46,172 [AWT-EventQueue-0] INFO   
> com.ish.angel.controller.EditController  - attempting to commit,  
> listing all objects in context:
> 2006-04-26 12:05:46,173 [AWT-EventQueue-0] INFO   
> com.ish.angel.controller.EditController  - 1  
> object :<com.ish.angel.cayenne.SubCategory@15880424,  
> id=<ObjectId:SubCategory, TEMP:000000F1D0423EC5>, state=new,  
> context=org.objectstyle.cayenne.CayenneContext@aaa10>
> 2006-04-26 12:05:46,173 [AWT-EventQueue-0] INFO   
> com.ish.angel.controller.EditController  - 2  
> object :<com.ish.angel.cayenne.Category@10349001,  
> id=<ObjectId:Category, id=200>, state=hollow,  
> context=org.objectstyle.cayenne.CayenneContext@aaa10>
>
> commitChanges() throws an exception:
>
> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2- 
> dev-2006-4-25 April 25 2006] Remote error. URL - http://localhost: 
> 8181/angel-server-cayenne
>         at  
> org.objectstyle.cayenne.remote.hessian.HessianConnection.doSendMessage 
> (HessianConnection.java:181)
>         at org.objectstyle.cayenne.remote.BaseConnection.sendMessage 
> (BaseConnection.java:109)
>         at org.objectstyle.cayenne.remote.ClientChannel.send 
> (ClientChannel.java:279)
>         at org.objectstyle.cayenne.remote.ClientChannel.onSync 
> (ClientChannel.java:188)
>         at org.objectstyle.cayenne.CayenneContext.doCommitChanges 
> (CayenneContext.java:233)
>         at org.objectstyle.cayenne.CayenneContext.commitChanges 
> (CayenneContext.java:220)
>         at com.ish.angel.controller.EditController.saveRecord 
> (EditController.java:287)
>
> on server side there is an exception thrown too:
>
> 2006-04-26 12:05:46,240 [SocketListener0-1] DEBUG  
> com.ish.angel.server.cayenne.glue.CayenneDataObject  - Changing  
> persistence state for class  
> com.ish.angel.server.cayenne.SubCategory from: transient to: new
> Apr 26, 2006 12:05:46 PM com.caucho.hessian.server.HessianSkeleton  
> invoke
> WARNING: java.lang.NullPointerException
> java.lang.NullPointerException
>         at  
> org.objectstyle.cayenne.map.EntityResolver.lookupObjEntity 
> (EntityResolver.java:514)
> 2006-04-26 12:05:46,640 [SocketListener0-1] DEBUG  
> com.ish.angel.server.cayenne.glue.CayenneDataObject  - Changing  
> persistence state for class  
> com.ish.angel.server.cayenne.SubCategory from: transient to: transient
>         at org.objectstyle.cayenne.access.ChildDiffLoader.arcCreated 
> (ChildDiffLoader.java:141)
>         at org.objectstyle.cayenne.graph.ArcCreateOperation.apply 
> (ArcCreateOperation.java:80)
>         at org.objectstyle.cayenne.graph.CompoundDiff.apply 
> (CompoundDiff.java:133)
>         at org.objectstyle.cayenne.access.DataContext.onContextFlush 
> (DataContext.java:1171)
>         at  
> org.objectstyle.cayenne.access.ClientServerChannel.onCommit 
> (ClientServerChannel.java:195)
>         at org.objectstyle.cayenne.access.ClientServerChannel.onSync 
> (ClientServerChannel.java:147)
>         at  
> org.objectstyle.cayenne.remote.service.DispatchHelper.dispatch 
> (DispatchHelper.java:80)
>         at  
> org.objectstyle.cayenne.remote.service.BaseRemoteService.processMessag 
> e(BaseRemoteService.java:182)
>         at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
> (DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at com.caucho.hessian.server.HessianSkeleton.invoke 
> (HessianSkeleton.java:157)
>         at  
> org.objectstyle.cayenne.remote.hessian.service._HessianServlet.service 
> (_HessianServlet.java:388)
>         at com.ish.angel.server.CayenneServlet.service 
> (CayenneServlet.java:59)
>         at org.mortbay.jetty.servlet.ServletHolder.handle 
> (ServletHolder.java:428)
>         at org.mortbay.jetty.servlet.ServletHandler.dispatch 
> (ServletHandler.java:666)
>         at org.mortbay.jetty.servlet.ServletHandler.handle 
> (ServletHandler.java:568)
>         at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
>         at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>         at org.mortbay.http.HttpServer.service(HttpServer.java:909)
>         at org.mortbay.http.HttpConnection.service 
> (HttpConnection.java:816)
>         at org.mortbay.http.HttpConnection.handleNext 
> (HttpConnection.java:982)
>         at org.mortbay.http.HttpConnection.handle 
> (HttpConnection.java:833)
>         at org.mortbay.http.SocketListener.handleConnection 
> (SocketListener.java:244)
>         at org.mortbay.util.ThreadedServer.handle 
> (ThreadedServer.java:357)
>         at org.mortbay.util.ThreadPool$PoolThread.run 
> (ThreadPool.java:534)
>
> I followed the stack trace. There is a call to
>
>         DataObject source = findObject(nodeId);
>
> 	which calls :
> 	
> 	graphManager.getNode(nodeId);
>
> in  ChildDiffLoader. In my case it appears to return null. (I cant  
> access cvs to put more logging into it to be 100% sure). Why getNode 
> () returns null ? Could that be because ObjectId has already  
> changed from TEMP id to permanent id ? (nodeId is actually  
> ObjectId, isn't it ?)
>
> Andrus, can you explain how is creating new object on server  
> processed ? I can see that after committing a new record on server  
> side this object is in transient state, and then it is inserted to  
> some context (transient -> new). Is that caused by the exception  
> that my object is then still in transient state ?
>
> Thank you
> Marcin
>
>
> -------------------------->
> 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



Re: toMany relationship not fetched

Posted by Marcin Skladaniec <ma...@ish.com.au>.
Hello !

I'm still trying to fix committing problem I have. I think that is it  
something in my code, but I cant find out what. Can someone suggest  
what can be wrong ?

I have two related objects in context, one is new, and one is hollow  
(because it was copied to this context using localObject() ):

2006-04-26 12:05:46,172 [AWT-EventQueue-0] INFO   
com.ish.angel.controller.EditController  - attempting to commit,  
listing all objects in context:
2006-04-26 12:05:46,173 [AWT-EventQueue-0] INFO   
com.ish.angel.controller.EditController  - 1  
object :<com.ish.angel.cayenne.SubCategory@15880424,  
id=<ObjectId:SubCategory, TEMP:000000F1D0423EC5>, state=new,  
context=org.objectstyle.cayenne.CayenneContext@aaa10>
2006-04-26 12:05:46,173 [AWT-EventQueue-0] INFO   
com.ish.angel.controller.EditController  - 2  
object :<com.ish.angel.cayenne.Category@10349001,  
id=<ObjectId:Category, id=200>, state=hollow,  
context=org.objectstyle.cayenne.CayenneContext@aaa10>

commitChanges() throws an exception:

org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2-dev-2006-4-25  
April 25 2006] Remote error. URL - http://localhost:8181/angel-server- 
cayenne
         at  
org.objectstyle.cayenne.remote.hessian.HessianConnection.doSendMessage 
(HessianConnection.java:181)
         at org.objectstyle.cayenne.remote.BaseConnection.sendMessage 
(BaseConnection.java:109)
         at org.objectstyle.cayenne.remote.ClientChannel.send 
(ClientChannel.java:279)
         at org.objectstyle.cayenne.remote.ClientChannel.onSync 
(ClientChannel.java:188)
         at org.objectstyle.cayenne.CayenneContext.doCommitChanges 
(CayenneContext.java:233)
         at org.objectstyle.cayenne.CayenneContext.commitChanges 
(CayenneContext.java:220)
         at com.ish.angel.controller.EditController.saveRecord 
(EditController.java:287)

on server side there is an exception thrown too:

2006-04-26 12:05:46,240 [SocketListener0-1] DEBUG  
com.ish.angel.server.cayenne.glue.CayenneDataObject  - Changing  
persistence state for class com.ish.angel.server.cayenne.SubCategory  
from: transient to: new
Apr 26, 2006 12:05:46 PM com.caucho.hessian.server.HessianSkeleton  
invoke
WARNING: java.lang.NullPointerException
java.lang.NullPointerException
         at org.objectstyle.cayenne.map.EntityResolver.lookupObjEntity 
(EntityResolver.java:514)
2006-04-26 12:05:46,640 [SocketListener0-1] DEBUG  
com.ish.angel.server.cayenne.glue.CayenneDataObject  - Changing  
persistence state for class com.ish.angel.server.cayenne.SubCategory  
from: transient to: transient
         at org.objectstyle.cayenne.access.ChildDiffLoader.arcCreated 
(ChildDiffLoader.java:141)
         at org.objectstyle.cayenne.graph.ArcCreateOperation.apply 
(ArcCreateOperation.java:80)
         at org.objectstyle.cayenne.graph.CompoundDiff.apply 
(CompoundDiff.java:133)
         at org.objectstyle.cayenne.access.DataContext.onContextFlush 
(DataContext.java:1171)
         at  
org.objectstyle.cayenne.access.ClientServerChannel.onCommit 
(ClientServerChannel.java:195)
         at org.objectstyle.cayenne.access.ClientServerChannel.onSync 
(ClientServerChannel.java:147)
         at  
org.objectstyle.cayenne.remote.service.DispatchHelper.dispatch 
(DispatchHelper.java:80)
         at  
org.objectstyle.cayenne.remote.service.BaseRemoteService.processMessage( 
BaseRemoteService.java:182)
         at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.caucho.hessian.server.HessianSkeleton.invoke 
(HessianSkeleton.java:157)
         at  
org.objectstyle.cayenne.remote.hessian.service._HessianServlet.service 
(_HessianServlet.java:388)
         at com.ish.angel.server.CayenneServlet.service 
(CayenneServlet.java:59)
         at org.mortbay.jetty.servlet.ServletHolder.handle 
(ServletHolder.java:428)
         at org.mortbay.jetty.servlet.ServletHandler.dispatch 
(ServletHandler.java:666)
         at org.mortbay.jetty.servlet.ServletHandler.handle 
(ServletHandler.java:568)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
         at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
         at org.mortbay.http.HttpServer.service(HttpServer.java:909)
         at org.mortbay.http.HttpConnection.service 
(HttpConnection.java:816)
         at org.mortbay.http.HttpConnection.handleNext 
(HttpConnection.java:982)
         at org.mortbay.http.HttpConnection.handle 
(HttpConnection.java:833)
         at org.mortbay.http.SocketListener.handleConnection 
(SocketListener.java:244)
         at org.mortbay.util.ThreadedServer.handle 
(ThreadedServer.java:357)
         at org.mortbay.util.ThreadPool$PoolThread.run 
(ThreadPool.java:534)

I followed the stack trace. There is a call to

         DataObject source = findObject(nodeId);

	which calls :
	
	graphManager.getNode(nodeId);

in  ChildDiffLoader. In my case it appears to return null. (I cant  
access cvs to put more logging into it to be 100% sure). Why getNode 
() returns null ? Could that be because ObjectId has already changed  
from TEMP id to permanent id ? (nodeId is actually ObjectId, isn't it ?)

Andrus, can you explain how is creating new object on server  
processed ? I can see that after committing a new record on server  
side this object is in transient state, and then it is inserted to  
some context (transient -> new). Is that caused by the exception that  
my object is then still in transient state ?

Thank you
Marcin


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



Re: toMany relationship not fetched

Posted by Andrus Adamchik <an...@objectstyle.org>.
I think this is the original message describing the problem:

http://objectstyle.org/cayenne/lists/cayenne-user/2006/04/0128.html

It looks like some objects are not faulted properly under certain  
circumstances.

Andrus

On Apr 19, 2006, at 4:11 AM, Marek Wawrzyczny wrote:
> Hi Andrus,
>
> I will attempt to see if I can reproduce the problem while Marcin  
> is gone.
> Unfortunately I have not been able to speak to him before he left  
> on holidays
> but I have been told that he apparently found that the object's  
> graph was
> getting corrupted i.r.t. the relationships.
> Apparently, subsequent changes to the many relationship left multiple
> artifacts in the graph, or something along these lines...
>
> I will attempt to replicate this in our little test project. Please  
> let me
> know if this makes any sense.
>
>
> Cheers,
>
> Marek Wawrzyczny
>
>
>
> On Thursday 13 April 2006 18:51, Andrus Adamchik wrote:
>> Marcin,
>>
>> I couldn't reproduce the problem. Let me know if you find any more
>> details. For instance it would be helpful to match your app output
>> with query messages sent via HessianConnection. Per CVS example
>> connection logging can be configured via Log4J to output stuff like
>> this:
>>
>> 1637 [main] INFO
>> org.objectstyle.cayenne.remote.hessian.HessianConnection  - ---
>> Message 10: Query
>> 11976 [main] INFO
>> org.objectstyle.cayenne.remote.hessian.HessianConnection  - ===
>> Message 10: Query done - took 339 ms.
>>
>> Also try todays build (2006-4-13 - should be available within an hour
>> or two), as it fixes a number of things that can be possibly related
>> (such as CAY-503).
>>
>> Sometime next week after B2 release I am planning to work on more
>> client examples. This way we'll have more regression cases available.
>>
>> Andrus
>>
>> On Apr 13, 2006, at 10:41 AM, Marcin Skladaniec wrote:
>>> 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
>


Re: toMany relationship not fetched

Posted by Marek Wawrzyczny <ma...@internode.on.net>.
Hi Andrus,

I will attempt to see if I can reproduce the problem while Marcin is gone. 
Unfortunately I have not been able to speak to him before he left on holidays 
but I have been told that he apparently found that the object's graph was 
getting corrupted i.r.t. the relationships. 
Apparently, subsequent changes to the many relationship left multiple 
artifacts in the graph, or something along these lines...

I will attempt to replicate this in our little test project. Please let me 
know if this makes any sense.


Cheers,

Marek Wawrzyczny



On Thursday 13 April 2006 18:51, Andrus Adamchik wrote:
> Marcin,
>
> I couldn't reproduce the problem. Let me know if you find any more
> details. For instance it would be helpful to match your app output
> with query messages sent via HessianConnection. Per CVS example
> connection logging can be configured via Log4J to output stuff like
> this:
>
> 1637 [main] INFO
> org.objectstyle.cayenne.remote.hessian.HessianConnection  - ---
> Message 10: Query
> 11976 [main] INFO
> org.objectstyle.cayenne.remote.hessian.HessianConnection  - ===
> Message 10: Query done - took 339 ms.
>
> Also try todays build (2006-4-13 - should be available within an hour
> or two), as it fixes a number of things that can be possibly related
> (such as CAY-503).
>
> Sometime next week after B2 release I am planning to work on more
> client examples. This way we'll have more regression cases available.
>
> Andrus
>
> On Apr 13, 2006, at 10:41 AM, Marcin Skladaniec wrote:
> > 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

Re: toMany relationship not fetched

Posted by Andrus Adamchik <an...@objectstyle.org>.
Marcin,

I couldn't reproduce the problem. Let me know if you find any more  
details. For instance it would be helpful to match your app output  
with query messages sent via HessianConnection. Per CVS example  
connection logging can be configured via Log4J to output stuff like  
this:

1637 [main] INFO  
org.objectstyle.cayenne.remote.hessian.HessianConnection  - ---  
Message 10: Query
11976 [main] INFO  
org.objectstyle.cayenne.remote.hessian.HessianConnection  - ===  
Message 10: Query done - took 339 ms.

Also try todays build (2006-4-13 - should be available within an hour  
or two), as it fixes a number of things that can be possibly related  
(such as CAY-503).

Sometime next week after B2 release I am planning to work on more  
client examples. This way we'll have more regression cases available.

Andrus


On Apr 13, 2006, at 10:41 AM, Marcin Skladaniec wrote:

> 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

Re: toMany relationship not fetched

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Apr 13, 2006, at 10:41 AM, Marcin Skladaniec wrote:

> 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 ?

Unfortunately this is a limitation of 1.2 - you have to have client  
classes on the server. We'll get rid of this dependency in the  
future. Hessian serialization will require some tweaking and also  
server-side ClientServerChannel.

Andrus


Re: toMany relationship not fetched

Posted by Marcin Skladaniec <ma...@ish.com.au>.
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



Re: toMany relationship not fetched

Posted by Andrus Adamchik <an...@objectstyle.org>.
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
>
>
>


Re: toMany relationship not fetched

Posted by Marcin Skladaniec <ma...@ish.com.au>.
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



Re: toMany relationship not fetched

Posted by Andrus Adamchik <an...@objectstyle.org>.
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:

> Hi
> Sorry to bother you once again, it looks so simple that I have no  
> idea what I'm doing wrong.
> I have ported this small example to 1.2B1 and removed "Client  
> Superclass" (but we are using it in our project). I tested it on os  
> x and linux.
> The problem persists.
>
> I get two objects room and site to the same context :
> 		Expression expression = ExpressionFactory.matchExp 
> (CSite.NAME_PROPERTY, "test site");
> 		SelectQuery query = new SelectQuery(CSite.class, expression);
> 		Expression expression2 = ExpressionFactory.matchExp 
> (CRoom.NAME_PROPERTY, "test room");
> 		SelectQuery query2 = new SelectQuery(CRoom.class, expression2);
> 		
> 		List list = context.performQuery(query);
> 		List list2 = context.performQuery(query2);
>
> 		CSite site = (CSite)list.get(0);
> 		CRoom room = (CRoom)list2.get(0);
>
>
> I set relationship:
> 		room.setSite(site);
> 	
> I save the context:
> 		context.commitChanges();
>
> At this point everything looks good. The relationship is set,  
> foreign key in database is set.
> Than in separate context I fetch the room again:
> 		List list2 = context2.performQuery(query2);
> 		CRoom room = (CRoom)list2.get(0);
>
> And hit the problem ...
> 		room.getSite() is null
> 			
> I updated the zipped example to work with 1.2B1 (http:// 
> smokidwa.freeshell.org/work/test.zip).
>
> Marcin
>
>
> On 08/04/2006, at 8:34 PM, Andrus Adamchik wrote:
>
>> Marcin,
>>
>> I ported your test to B1 and ran it on my machine - it works  
>> without any errors. Can you confirm whether this is still a problem?
>>
>> BTW, I noticed one minor thing in the mapping - you should not  
>> populate "Client Superclass" field. This field is for the "wedge"  
>> class that may optionally be inserted in the inheritance hierarchy  
>> between cayenne.Persistent and _MyObject.
>>
>> Andrus
>>
>>
>> On Mar 28, 2006, at 2:49 AM, Marcin Skladaniec wrote:
>>
>>> Hello
>>> I tried with cayenne 1.2M12 but have the same problem.
>>> Here is a small project based on the 3t example from sandbox
>>> reproducing the malfunction I'm seeing. (http:// 
>>> smokidwa.freeshell.org/work/test.zip)
>>> all jars needed to run project are on http:// 
>>> smokidwa.freeshell.org/work/
>>> Marcin
>>>
>>> On 27/03/2006, at 5:56 PM, Tore Halset wrote:
>>>
>>>> On Mar 19, 2006, at 23:48, Marcin Skladaniec wrote:
>>>>
>>>>> I created a brand new project and I'm still having this  
>>>>> problem. Double-checked out the relations, the data types are  
>>>>> matching.
>>>>> I have done some more testing and found that one-to-many and  
>>>>> many-to-many flattened relations work. That is only many-to-one  
>>>>> that not works.
>>>>> What else can be wrong ?
>>>>
>>>> Can you create a small test-project to reproduce this behaviour?  
>>>> It will make it easier for us to help out.
>>>>
>>>>  - Tore.
>>>
>>> -------------------------->
>>> 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
>
>
>


Re: toMany relationship not fetched

Posted by Marcin Skladaniec <ma...@ish.com.au>.
Hi
Sorry to bother you once again, it looks so simple that I have no  
idea what I'm doing wrong.
I have ported this small example to 1.2B1 and removed "Client  
Superclass" (but we are using it in our project). I tested it on os x  
and linux.
The problem persists.

I get two objects room and site to the same context :
		Expression expression = ExpressionFactory.matchExp 
(CSite.NAME_PROPERTY, "test site");
		SelectQuery query = new SelectQuery(CSite.class, expression);
		Expression expression2 = ExpressionFactory.matchExp 
(CRoom.NAME_PROPERTY, "test room");
		SelectQuery query2 = new SelectQuery(CRoom.class, expression2);
		
		List list = context.performQuery(query);
		List list2 = context.performQuery(query2);

		CSite site = (CSite)list.get(0);
		CRoom room = (CRoom)list2.get(0);


I set relationship:
		room.setSite(site);
	
I save the context:
		context.commitChanges();

At this point everything looks good. The relationship is set, foreign  
key in database is set.
Than in separate context I fetch the room again:
		List list2 = context2.performQuery(query2);
		CRoom room = (CRoom)list2.get(0);

And hit the problem ...
		room.getSite() is null
			
I updated the zipped example to work with 1.2B1 (http:// 
smokidwa.freeshell.org/work/test.zip).

Marcin


On 08/04/2006, at 8:34 PM, Andrus Adamchik wrote:

> Marcin,
>
> I ported your test to B1 and ran it on my machine - it works  
> without any errors. Can you confirm whether this is still a problem?
>
> BTW, I noticed one minor thing in the mapping - you should not  
> populate "Client Superclass" field. This field is for the "wedge"  
> class that may optionally be inserted in the inheritance hierarchy  
> between cayenne.Persistent and _MyObject.
>
> Andrus
>
>
> On Mar 28, 2006, at 2:49 AM, Marcin Skladaniec wrote:
>
>> Hello
>> I tried with cayenne 1.2M12 but have the same problem.
>> Here is a small project based on the 3t example from sandbox
>> reproducing the malfunction I'm seeing. (http:// 
>> smokidwa.freeshell.org/work/test.zip)
>> all jars needed to run project are on http:// 
>> smokidwa.freeshell.org/work/
>> Marcin
>>
>> On 27/03/2006, at 5:56 PM, Tore Halset wrote:
>>
>>> On Mar 19, 2006, at 23:48, Marcin Skladaniec wrote:
>>>
>>>> I created a brand new project and I'm still having this problem.  
>>>> Double-checked out the relations, the data types are matching.
>>>> I have done some more testing and found that one-to-many and  
>>>> many-to-many flattened relations work. That is only many-to-one  
>>>> that not works.
>>>> What else can be wrong ?
>>>
>>> Can you create a small test-project to reproduce this behaviour?  
>>> It will make it easier for us to help out.
>>>
>>>  - Tore.
>>
>> -------------------------->
>> 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