You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Armin Waibel <ar...@code-au-lait.de> on 2003/12/23 01:42:20 UTC

Re: reload Object ? ? (Problem Cache)

Hi,

in your example only 2 System.out.println(..) lines performed, but 3 
lines are printed?! Do you forget one println() statement?

regards,
Armin

Reda Benzair wrote:
> Hi all,
> 
>  
> 
> I have a -simple?- question about OJB cache:
> 
>  
> 
> How can I force refreshing an object? Typically is there a method like
> PB.refreshObject(Object o)? -I know of course this one doesn't exist...-
> 
>  
> 
> To be more precise, I have someting like this:
> 
> PersistenceBroker pb =
> PersistenceBrokerFactory.createPersistenceBroker("jcd", "user", "pass");
> Criteria crit = new Criteria();
> crit.addEqualTo("Id", new Integer(505));
> Employee employee505 = (Employee) pb.getObjectByQuery(new
> QueryByCriteria(Employee.class, crit));
> 
> System.out.println("ID 505 = " + employee505.getName() + " " +
> employee505);
> 
> employee505.setName("MODIFIED " + employee505.getName()); 
> // modified but not stored... should be erased by remove + reload?
> pb.removeFromCache(employee505);
> employee505 = (Employee) pb.getObjectByQuery(new
> QueryByCriteria(Employee.class, crit));
> 
> System.out.println("505 = " + employee505.getName() + " " +
> employee505);
> 
 >
 >
> The standard output is:
> 
> 505 = John Doe sj.employeeRhBr.bean.EmployeeRhBrImpl@e33e18
> 
> 505 = MODIFIED john Doe sj.employeeRhBr.bean.EmployeeRhBrImpl@e33e18
> 
> 505 = John Doe sj.employeeRhBr.bean.EmployeeRhBrImpl@48f675
> 
> And I would have liked line2 to be exactly equal to line1. Where am I
> wrong?
> 
>  
> 
> Thank you very much by advance, since this blocks my team on the
> production environment...
> 
>  
> 
> 



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


RE: reload Object ? ? (Problem Cache)

Posted by Reda Benzair <re...@smartjog.com>.
Hi Armin 
two instance different ??


-----Original Message-----
From: Armin Waibel [mailto:armin@code-au-lait.de] 
Sent: mardi 23 décembre 2003 01:42
To: OJB Users List
Subject: Re: reload Object ? ? (Problem Cache)

Hi,

in your example only 2 System.out.println(..) lines performed, but 3 
lines are printed?! Do you forget one println() statement?

regards,
Armin

Reda Benzair wrote:
> Hi all,
> 
>  
> 
> I have a -simple?- question about OJB cache:
> 
>  
> 
> How can I force refreshing an object? Typically is there a method like
> PB.refreshObject(Object o)? -I know of course this one doesn't
exist...-
> 
>  
> 
> To be more precise, I have someting like this:
> 
> PersistenceBroker pb =
> PersistenceBrokerFactory.createPersistenceBroker("jcd", "user",
"pass");
> Criteria crit = new Criteria();
> crit.addEqualTo("Id", new Integer(505));
> Employee employee505 = (Employee) pb.getObjectByQuery(new
> QueryByCriteria(Employee.class, crit));
> 

--------------------------> First print System.out.println("ID 505 = " +
employee505.getName() + " " +employee505);


> 
> employee505.setName("MODIFIED " + employee505.getName()); 

-------------------------> print 2 System.out.println("AFTER MODIF
:\t505 = " + emp.getName () + " \t(" + emp + ")");
System.out.println("Remove from cache...");
--------------------> modified but not stored... should be erased by
remove + reload?
>>>>>>>>> pb.removeFromCache(employee505);
> employee505 = (Employee) pb.getObjectByQuery(new
> QueryByCriteria(Employee.class, crit));
> 
> System.out.println("505 = " + employee505.getName() + " " +
> employee505);
> 
 >
 >
> The standard output is:
> 
> 505 = John Doe sj.employeeRhBr.bean.EmployeeRhBrImpl@e33e18
> 
> 505 = MODIFIED john Doe sj.employeeRhBr.bean.EmployeeRhBrImpl@e33e18
> 
> 505 = John Doe sj.employeeRhBr.bean.EmployeeRhBrImpl@48f675
> 
> And I would have liked line2 to be exactly equal to line1. Where am I
> wrong?
> 
>  
> 
> Thank you very much by advance, since this blocks my team on the
> production environment...
> 
>  
> 
> 



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



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