You're right. Sorry.

The third line is the one I get after I call pb.clearCache(). And it's
the one I would rather get instead of line 2.

Something I noticed since I posted this message : This sample code works
great if the query concerns "classical" classes instead of Employee :
Employee is an extent.

<class-descriptor class="sj.employee.bean.Employee">
        <extent-class class-ref="sj.employee.bean.EmployeeImpl"/>
        <extent-class class-ref="sj.employeeRh.bean.EmployeeRhImpl"/>
        <extent-class class-ref="sj.employeeBr.bean.EmployeeBrImpl"/>
        <extent-class
class-ref="sj.employeeRhBr.bean.EmployeeRhBrImpl"/>
</class-descriptor>
<class-descriptor class="sj.employee.bean.EmployeeImpl"
table="EMPLOYEE">
        <!-- .............. -->
</class-descriptor>
<!-- .............. -->
<class-descriptor class="sj.employee.bean.EmployeeRhBr">
        <extent-class
class-ref="sj.employeeRhBr.bean.EmployeeRhBrImpl"/>
</class-descriptor>
<class-descriptor class="sj.employee.bean.EmployeeRhBrImpl"
table="EMPLOYEE">
        <!-- .............. -->
</class-descriptor>

=> If I create a new Identity(employee505, pb), the resulting object
does not match (.equals + .hascode) the one that already exists in the
cache : removeFromCache has no effect, wich explains the strange
behaviour above. As a workaround, I have removed all extents from my
repository but it's a shame...

What should I do?


-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
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));
> 
> 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 [EMAIL PROTECTED]
> 
> 505 = MODIFIED john Doe [EMAIL PROTECTED]
> 
> 505 = John Doe [EMAIL PROTECTED]
> 
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to