db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Russell <Craig.Russ...@Sun.COM>
Subject Completeness test and Company model
Date Sun, 28 Aug 2005 05:49:25 GMT
Hi,

I've looked closely at the strategy for making persistent interfaces  
and concluded that we cannot split out the "getters" from the  
"setters" in the interface. The spring framework doesn't allow  
asymmetric get and set methods. In particular, in Employee class, if  
we have a method void setDepartment(Department), we must have a  
method Department getDepartment(). It's not allowed to have void  
setDepartment(Department) and have IDepartment getDepartment().

So I've updated the company package to add the interface classes. I  
had to remove the extraneous add and remove methods since these are  
not bean pattern methods.

I've also implemented the DeepEquals.deepCompareFields and  
EqualityHelper.equals(Object, Object, String). They have allowed me  
to see where the relationship tests are failing.

Here's a sample of what to expect:

     public boolean deepCompareFields(Object other,
                                      EqualityHelper helper) {
         IPerson otherPerson = (IPerson)other;
         String where = "Person[" + "]";
         return
             helper.equals(personid, otherPerson.getPersonid(), where  
+ "(personid)") &
             helper.equals(firstname, otherPerson.getFirstname(),  
where + "(firstname)") &
             helper.equals(lastname, otherPerson.getLastname(), where  
+ "(lastname)") &
             helper.equals(middlename, otherPerson.getMiddlename(),  
where + "(middlename)") &
             helper.equals(birthdate, otherPerson.getBirthdate(),  
where + "(birthdate)") &
             helper.deepEquals(address, otherPerson.getAddress(),  
where + "(address)") &
             helper.deepEquals(phoneNumbers,  
otherPerson.getPhoneNumbers(), where + "(phoneNumbers)");
     }

The tests are failing in navigating from Employee to  
medicalInsurance. The code is apparently not constraining the query  
to just instances of medical insurance, so it's retrieving rows that  
were stored as dental insurance. This causes two distinct behaviors:  
classCastException while lazy loading the medical insurance field  
with application identity, and failure to compare while lazy loading  
the medical insurance field with datastore identity.

I've double checked the metadata and now I'll take a look at the jpox  
log. Might be something interesting there. And I'll file a JIRA issue.

Craig

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message