Quantcast

Is it Possible to Update Inheritance Hierarchies?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is it Possible to Update Inheritance Hierarchies?

Schmidt
Hi,

Considerer the following hierarchy:

Person <- Employee <- Boss

Each class is maped to a distinct table (Mapping Classes on Multiple Joined Tables)
In this case, if I create an employee, two records are persisted in the DB (1 person and 1 employee). What if this employee is promoted to a boss? How can we update the hierarchy including just 1 new record at the end of the chain? I've tried, but the whole chain is created again. Is it possible to instruct OJB to just "append" 1 record at the Boss table?
Anyone here ever faced the same issue?

Thanks in advance!
Cleverson Schmidt
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it Possible to Update Inheritance Hierarchies?

Armin Waibel
Hi Cleverson,

Schmidt wrote:

> Hi,
>
> Considerer the following hierarchy:
>
> Person <- Employee <- Boss
>
> Each class is maped to a distinct table (Mapping Classes on Multiple Joined
> Tables)
> In this case, if I create an employee, two records are persisted in the DB
> (1 person and 1 employee). What if this employee is promoted to a boss? How
> can we update the hierarchy including just 1 new record at the end of the
> chain? I've tried, but the whole chain is created again. Is it possible to
> instruct OJB to just "append" 1 record at the Boss table?

Sorry no! It's a new Boss object, so OJB creates the whole hierarchy
with the new Boss object identity.

regards,
Armin

> Anyone here ever faced the same issue?
>
> Thanks in advance!
> Cleverson Schmidt

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it Possible to Update Inheritance Hierarchies?

Schmidt
Thanks a lot Armin!

Just for the record in the case someone faces the same issue.
I changed the Boss class to just hold a FK to the Employee table and there is no "extends" relationship anymore between Boss and Employee. Now I can create just the Boss object and attach it to an existing Employee.

Cleverson Schmidt

Armin Waibel wrote
Hi Cleverson,

Schmidt wrote:
> Hi,
>
> Considerer the following hierarchy:
>
> Person <- Employee <- Boss
>
> Each class is maped to a distinct table (Mapping Classes on Multiple Joined
> Tables)
> In this case, if I create an employee, two records are persisted in the DB
> (1 person and 1 employee). What if this employee is promoted to a boss? How
> can we update the hierarchy including just 1 new record at the end of the
> chain? I've tried, but the whole chain is created again. Is it possible to
> instruct OJB to just "append" 1 record at the Boss table?

Sorry no! It's a new Boss object, so OJB creates the whole hierarchy
with the new Boss object identity.

regards,
Armin

> Anyone here ever faced the same issue?
>
> Thanks in advance!
> Cleverson Schmidt

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