openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ricardo Andere de Mello" <>
Subject Re: Historical Session
Date Tue, 22 May 2007 19:21:35 GMT
only the OneToOne relationship can be solved with a query (since "historical
id" is managed and endDate = null)
all the other kinds of relationship (OneToMany, ManyToOne, ManyToMany)
should need a historical join table (using the historical id as key, and
having start and end date too)

little example:

- A points to list of B's.
- a specific B of the list changes several times, since the join table
points to the historical id, it works ok, getting the last one.
- now I want to remove some B's and add new ones, the join table must be
"finalized" and a new one created, because if I "go back in time", I must
know what list of B's was valid at that moment.

[]s, gandhi

2007/5/22, Craig L Russell <>:
> Hi,
> On May 22, 2007, at 5:59 AM, Ricardo Andere de Mello wrote:
> > anyway, the "selected automatically" part is not simple. ;-)
> > every relatioship must be historical and means you will need a join
> > table to
> > do it.
> I haven't studied this in detail, but it seems that if you have a
> foreign key in one table that refers directly to another table, and
> if you select the historically correct rows from each table, then a
> join table isn't needed. This works even in the case of changing the
> foreign key value, since the historically correct version of the row
> has the correct foreign key value.
> What case requires a separate join table?
> Regards,
> Craig
> Craig Russell
> Architect, Sun Java Enterprise System
> 408 276-5638
> P.S. A good JDO? O, Gasp!

Ricardo Andere de Mello
Presidente do Quilombo Digital
55 (11) 3271-7928 / 55 (11) 9917-7722

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message