You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by SE...@lohndirekt.de on 2003/12/16 11:39:57 UTC

Making all implementors of IF persistent

Hi,
I want to map a table to an interface.
I have some persistent classes and their according interfaces. 
I also have some decorators wich add some aspects to the persistent classes
(e.g. change listening) and also implementing their respective interface.
Now I want to save the decorators directly instead of first unwrapping them.
Since all decorators are implementing the interface, ojb should know how to
save them.
The problem is that ojb doesn't know the decorator so it throws a
ClassNotPersistenceCapableException.

Do you have any ideas how to solve this?

Thanks in advance,
Sven

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Making all implementors of IF persistent

Posted by Justis Peters <ju...@oculan.com>.
Hi Sven,

We have implemented this in our project here, and it works great.  Check out the following tutorial:
  http://db.apache.org/ojb/tutorial3.html

In particular, check out the sections titled "Extents and Polymorphism" and "Mapping Inheritance Hierarchies":
  http://db.apache.org/ojb/tutorial3.html#Extents and Polymorphism
  http://db.apache.org/ojb/tutorial3.html#Mapping Inheritance Hierarchies

 
We are using the mapping technique where each subclass has its own table, and OJB combines them together for you.  I've had so much luck with this that we have begun using polymorphic references in most of our classes.  Thus, many of my classes contain fields with a type as abstract as "Document", and there are 20 different classes that implement "Document".  This has been great, because I can write special handlers in my webapp that can perform operations on any Document, regardless of which subclass it is.

Anyhow, enjoy!

Regards,
Justis Peters
Oculan Corp.

SEfftinge@lohndirekt.de [SEfftinge@lohndirekt.de] wrote:
> Hi,
> I want to map a table to an interface.
> I have some persistent classes and their according interfaces. 
> I also have some decorators wich add some aspects to the persistent classes
> (e.g. change listening) and also implementing their respective interface.
> Now I want to save the decorators directly instead of first unwrapping them.
> Since all decorators are implementing the interface, ojb should know how to
> save them.
> The problem is that ojb doesn't know the decorator so it throws a
> ClassNotPersistenceCapableException.
> 
> Do you have any ideas how to solve this?
> 
> Thanks in advance,
> Sven
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Making all implementors of IF persistent

Posted by Thomas Mahler <th...@web.de>.
Mhh, I guess you should add a class-descriptor for each Decorator class 
into the reository.

then you have to define a class-descriptor for the IF and add extent 
class definitions for all decorator classes.

Thomas

SEfftinge@lohndirekt.de wrote:
> Hi,
> I want to map a table to an interface.
> I have some persistent classes and their according interfaces. 
> I also have some decorators wich add some aspects to the persistent classes
> (e.g. change listening) and also implementing their respective interface.
> Now I want to save the decorators directly instead of first unwrapping them.
> Since all decorators are implementing the interface, ojb should know how to
> save them.
> The problem is that ojb doesn't know the decorator so it throws a
> ClassNotPersistenceCapableException.
> 
> Do you have any ideas how to solve this?
> 
> Thanks in advance,
> Sven
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org