You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by "Martin Taal (JIRA)" <ji...@apache.org> on 2005/04/19 22:40:24 UTC

[jira] Created: (OJB-29) Infinite loop in case of refresh=true and cycles in references

Infinite loop in case of refresh=true and cycles in references
--------------------------------------------------------------

         Key: OJB-29
         URL: http://issues.apache.org/jira/browse/OJB-29
     Project: OJB
        Type: Bug
  Components: PB-API  
    Versions: 1.0.3    
    Reporter: Martin Taal
 Attachments: testcasesimple.zip

Hi Armin,
I have attached the objects I try to persist, the sql to generate the database and the repository xml in the zip file which I will attach shortly. I execute the code below to get a loop (and a stack overflow). 

Let me know if my setup is wrong.

Good luck!

gr. Martin

	    PersistenceBroker broker = null;
	    try
	    {
	    	broker = PersistenceBrokerFactory.createPersistenceBroker(pbkey);
	    	{
		        final A myA = new A();
		        final B myB = new B();
		        myA.setName("I am a");
		        myA.setMyB(myB);
		        myB.setName("I am b");
		        myB.setMyA(myA);
		        broker.beginTransaction();
		        broker.store(myA);
		        broker.store(myB);
		        broker.commitTransaction();
	    	}
	    	
	    	// now read again
	    	{
		        broker.clearCache();
		        Criteria criteria = new Criteria();
		        criteria.addEqualTo("Name", "I am a");
		        
		        QueryByCriteria query = QueryFactory.newQuery(A.class, criteria);
		        A myA =  (A)broker.getObjectByQuery(query);

                        // Here it loops (and stops with a stack overflow)
		        assertTrue(myA.getMyB().getName().compareTo("I am b") == 0);
	    	}
	    }
	    finally
	    {
	        if (broker != null) broker.close();
	    }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


[jira] Updated: (OJB-29) Infinite loop in case of refresh=true and cycles in references

Posted by "Martin Taal (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/OJB-29?page=all ]

Martin Taal updated OJB-29:
---------------------------

    Attachment: testcasesimple.zip

> Infinite loop in case of refresh=true and cycles in references
> --------------------------------------------------------------
>
>          Key: OJB-29
>          URL: http://issues.apache.org/jira/browse/OJB-29
>      Project: OJB
>         Type: Bug
>   Components: PB-API
>     Versions: 1.0.3
>     Reporter: Martin Taal
>  Attachments: testcasesimple.zip
>
> Hi Armin,
> I have attached the objects I try to persist, the sql to generate the database and the repository xml in the zip file which I will attach shortly. I execute the code below to get a loop (and a stack overflow). 
> Let me know if my setup is wrong.
> Good luck!
> gr. Martin
> 	    PersistenceBroker broker = null;
> 	    try
> 	    {
> 	    	broker = PersistenceBrokerFactory.createPersistenceBroker(pbkey);
> 	    	{
> 		        final A myA = new A();
> 		        final B myB = new B();
> 		        myA.setName("I am a");
> 		        myA.setMyB(myB);
> 		        myB.setName("I am b");
> 		        myB.setMyA(myA);
> 		        broker.beginTransaction();
> 		        broker.store(myA);
> 		        broker.store(myB);
> 		        broker.commitTransaction();
> 	    	}
> 	    	
> 	    	// now read again
> 	    	{
> 		        broker.clearCache();
> 		        Criteria criteria = new Criteria();
> 		        criteria.addEqualTo("Name", "I am a");
> 		        
> 		        QueryByCriteria query = QueryFactory.newQuery(A.class, criteria);
> 		        A myA =  (A)broker.getObjectByQuery(query);
>                         // Here it loops (and stops with a stack overflow)
> 		        assertTrue(myA.getMyB().getName().compareTo("I am b") == 0);
> 	    	}
> 	    }
> 	    finally
> 	    {
> 	        if (broker != null) broker.close();
> 	    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


[jira] Assigned: (OJB-29) Infinite loop in case of refresh=true and cycles in references

Posted by "Armin Waibel (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/OJB-29?page=all ]

Armin Waibel reassigned OJB-29:
-------------------------------

    Assign To: Armin Waibel

> Infinite loop in case of refresh=true and cycles in references
> --------------------------------------------------------------
>
>          Key: OJB-29
>          URL: http://issues.apache.org/jira/browse/OJB-29
>      Project: OJB
>         Type: Bug
>   Components: PB-API
>     Versions: 1.0.3
>     Reporter: Martin Taal
>     Assignee: Armin Waibel
>  Attachments: testcasesimple.zip
>
> Hi Armin,
> I have attached the objects I try to persist, the sql to generate the database and the repository xml in the zip file which I will attach shortly. I execute the code below to get a loop (and a stack overflow). 
> Let me know if my setup is wrong.
> Good luck!
> gr. Martin
> 	    PersistenceBroker broker = null;
> 	    try
> 	    {
> 	    	broker = PersistenceBrokerFactory.createPersistenceBroker(pbkey);
> 	    	{
> 		        final A myA = new A();
> 		        final B myB = new B();
> 		        myA.setName("I am a");
> 		        myA.setMyB(myB);
> 		        myB.setName("I am b");
> 		        myB.setMyA(myA);
> 		        broker.beginTransaction();
> 		        broker.store(myA);
> 		        broker.store(myB);
> 		        broker.commitTransaction();
> 	    	}
> 	    	
> 	    	// now read again
> 	    	{
> 		        broker.clearCache();
> 		        Criteria criteria = new Criteria();
> 		        criteria.addEqualTo("Name", "I am a");
> 		        
> 		        QueryByCriteria query = QueryFactory.newQuery(A.class, criteria);
> 		        A myA =  (A)broker.getObjectByQuery(query);
>                         // Here it loops (and stops with a stack overflow)
> 		        assertTrue(myA.getMyB().getName().compareTo("I am b") == 0);
> 	    	}
> 	    }
> 	    finally
> 	    {
> 	        if (broker != null) broker.close();
> 	    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


[jira] Closed: (OJB-29) Infinite loop in case of refresh=true and cycles in references

Posted by "Armin Waibel (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/OJB-29?page=all ]
     
Armin Waibel closed OJB-29:
---------------------------

    Fix Version: 1.0.4
     Resolution: Fixed

Add test case to OJB test suite BidirectionalAssociationTest#testAutoRefreshTrue() this test fails before the fix and now the test pass.
OJB now lookup for locally cached objects and does not refresh the references when the object is already locally cached.

> Infinite loop in case of refresh=true and cycles in references
> --------------------------------------------------------------
>
>          Key: OJB-29
>          URL: http://issues.apache.org/jira/browse/OJB-29
>      Project: OJB
>         Type: Bug
>   Components: PB-API
>     Versions: 1.0.3
>     Reporter: Martin Taal
>     Assignee: Armin Waibel
>      Fix For: 1.0.4
>  Attachments: testcasesimple.zip
>
> Hi Armin,
> I have attached the objects I try to persist, the sql to generate the database and the repository xml in the zip file which I will attach shortly. I execute the code below to get a loop (and a stack overflow). 
> Let me know if my setup is wrong.
> Good luck!
> gr. Martin
> 	    PersistenceBroker broker = null;
> 	    try
> 	    {
> 	    	broker = PersistenceBrokerFactory.createPersistenceBroker(pbkey);
> 	    	{
> 		        final A myA = new A();
> 		        final B myB = new B();
> 		        myA.setName("I am a");
> 		        myA.setMyB(myB);
> 		        myB.setName("I am b");
> 		        myB.setMyA(myA);
> 		        broker.beginTransaction();
> 		        broker.store(myA);
> 		        broker.store(myB);
> 		        broker.commitTransaction();
> 	    	}
> 	    	
> 	    	// now read again
> 	    	{
> 		        broker.clearCache();
> 		        Criteria criteria = new Criteria();
> 		        criteria.addEqualTo("Name", "I am a");
> 		        
> 		        QueryByCriteria query = QueryFactory.newQuery(A.class, criteria);
> 		        A myA =  (A)broker.getObjectByQuery(query);
>                         // Here it loops (and stops with a stack overflow)
> 		        assertTrue(myA.getMyB().getName().compareTo("I am b") == 0);
> 	    	}
> 	    }
> 	    finally
> 	    {
> 	        if (broker != null) broker.close();
> 	    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org