Hello Ken,

> -----Original Message-----

> I was able to make it work by pointing the collection-descriptor and
> reference-descriptor to AccountImpl instead of Account like 
> below. 

fine.

[..]

> Of course I have to cast to Account though.

I do not understand that.  Where do you do that cast?
It is an upcast, isn't it?  Then it is never needed in Java.

> I was also able to make it work by removing the interface from the
> repository altoghether like this:

[..]

> I was also surprised to find that the Interface doesn't even 
> have to declare
> any methods and it still works! Now that I've spent 4 hours

The method your interface declares are a matter of your 
application.  It is irrelevant to OJB.  Even if you add
field-descriptors to the interface' class-descriptor,
it still does not matter for OJB which methods
the interface declares.  It is just important that
each implementing class (or at least each class that
OJB has to store/retrieve instances of) has corresponding
fields (or bean accessors, depending on setting of
PersistentFieldClass in OJB.properties).

> making it work,
> I'm wondering how it's supposed to work or what best practice 
> others have

I suggest that the fields' types are interfaces.  That is good
practice in Java anyway, and you will need it do use the proxy
feature.  If you expect not to use any other implementation
of that interface with OJB, there is no need to bother the 
repository_user.xml with it, so I recommend not to mention 
the interface there.

> found. All of these methods seem to require my client code to use
> AccountImpl in some places but Account in others. Is that right?

I do not understand that.  Where in your application
do you need AccountImpl?

In our application, we have one interface for each 
persistence-capable class.  The persistence-capable class
has OJB-specific fields, but the interface is independent from 
OJB. The rest of the application is programmed against the
interfaces. If we should ever support another O/R-mapper, we
have to re-implement the interfaces and provide another 
factory.

Olli

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

Reply via email to