Hi Ken,

Ken Brewer wrote:
I just started using OJB and so far so good. I'm confused about the dynamic
proxies. Previous to OJB, my object model used inheritance but no
interfaces. Because I want lazy loading, I created an interface for nearly
every class. I simply named these interfaces 'I + classname' e.g. Account
now has an interface IAccount. I noticed that I had to change my cast from
the class to the interface when retrieving collection elements.

1. My application is substantially complete and has many references to the
class names e.g. Account. it seems I should have used the scheme
Account(interface) & AccountImpl(class) in order to avoid breaking my
application code references to Account, RIGHT?

The OJB proxy mechanism provides a wrapper implementation for the concrete AccountImpl. This wrapper implementation (which does the lazy load) implements the interface Account.
So in you business object you always have to use the interface Account to work safely with proxies.
Of course it makes sense to have convenient naming convention to differentiate between interfaces and proxies. But OJB does not force you to any special names.


2. When casting objects from a collection, should I cast to the class name
or proxy interface name?

When using proxies always use the interface name. see explanation above.


3. Must I include the full hierarchy, including interfaces, in my
repository.xml even though the interfaces are for dynamic proxies only?

You must include at least one extent definition for the interface to allow OJB to perform queries against that interface type.
But you do not have to declare the complete hierarchy.


4. In the repository.xml, it seems that all superclass elements must be
duplicated in each subclass? Is that correct?

That depends on the mapping strategy. See http://db.apache.org/ojb/tutorial3.html#mapping%20inheritance%20hierarchies for details.



cu, Thomas

Thanks,


-ken



---------------------------------------------------------------------
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