Hi Guys,
Another interesting aspect that I came across, perhaps best explained
via a small example
public class Customer {
..verride
public AccountsCustomer getAccountsCustomer() {
AccountsCustomer accCustomer = super.getAccountsCustomer();
try {
accCustomer.getCustomerCode();
} catch (Exception e) {
// we need to aslo check without case sensetivity.
try {
accCustomer =
DataObjectUtils.objectForPK(getObjectContext(),
AccountsCustomer.class, getCustomerCode());
accCustomer.getCustomerCode();
} catch (Exception e1) {
return null;
}
}
return accCustomer;
}
}
I have a Customer class which represents the customer in the web
database, within this class I have getAccountsCustomer() which
actually pulls the record from a customer table in the accounts
database. Now I have no control over the structure of this accounts
database, and the primary keys of the customer table as meaningful
string representations of the customer code.
Now in the getAccountsCustomer method above which I am overriding from
_Customer the first call super.getAccountsCustomer(); actually returns
a hollow object and since I do not want the hollow object but rather a
null I call the getCustomerCode method causing a Fault Exception and
subsequently return null.
This all works fine but only when the customer code cases are the same
in both databases.
So in my test case I reset the customer code in the web customer to
the same as it is in the accounts customer but to lower case and my
getAccountsCustomer() method starts returning null.
This was the case until I put in the second try block which uses
DataObjectUtils (as shown above). The DataObjectUtils.objectForPK
seems to work ignoring cases while the readProperty methods seem to
case sensitive.
Just felt like a bit of an inconsistency.
Cheers,
Gary
This archive was generated by hypermail 2.0.0 : Thu May 27 2010 - 00:42:54 UTC