Re: Historical Session

2007-05-22 Thread Ricardo Andere de Mello

well...
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 <[EMAIL PROTECTED]>:


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 http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!






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


Re: Historical Session

2007-05-22 Thread 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 http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!



smime.p7s
Description: S/MIME cryptographic signature


Re: Historical Session

2007-05-22 Thread Ricardo Andere de Mello

yes, associating a time to entitymanager is a good approach, but remember
that sometimes you just want to look to some data in past, and everything
can be in present, like "customer: - last year my contract was this way,
then changed twice, I want to go back to my old contract".
both features are ok. AFAIK toplink has both.
anyway, the "selected automatically" part is not simple. ;-)
every relatioship must be historical and means you will need a join table to
do it.
some constrains cant be forced, like the historical id, you cant say it will
be unique, because it will have duplicates.

[]s, gandhi

2007/5/21, Craig L Russell <[EMAIL PROTECTED]>:


As I've had it explained to me, you would not choose the time in a
user-generated or user-visible query. Instead, the user would set the
time and associate it with an EntityManager. The time is invisible to
normal entity operations, including queries. For each query for a
temporal object (the terminology I've heard) the EntityManager would
include the appropriate WHERE clauses into the SQL that would select
the proper instances based on the time.

So a find by primary key, navigation, or query would have the
appropriate WHERE clauses generated with no action on the part of the
user.

In the example below, the A instance doesn't need to worry about
which B it refers to, because the B instances corresponding to A's
time are also selected automatically, in that both A and B have
corresponding temporal WHERE clauses based on the same time.

Craig

On May 21, 2007, at 3:16 PM, Ricardo Andere de Mello wrote:

> yes this look something simple, but it is not...
> see, objects exists in time, so for example, they are not deleted,
> they are
> "finalized".
> the worst part are the relationships, because they are historical
> too...
> basically you have a start and end date for that object, and the
> object with
> end date null is the actual object.
> everytime you modify an object you clone it, set the end date of
> the old,
> and set the start date of the new.
> imagine now that "A" points to "B". both are historical objects. if
> "B" is
> modified, a new historical object is created. "A" should point to
> the new
> "B", not the old one. so you must have a "historical id" or a
> "historical id
> object" to point at, that is common to all "B".
>
> []s, gandhi
>
> 2007/5/21, Marc Prud'hommeaux <[EMAIL PROTECTED]>:
>>
>>
>> Something like: "select x from Employee x as x was on January 1,
>> 2002"
>>
>>
>>
>> On May 21, 2007, at 11:01 AM, Kevin Sutter wrote:
>>
>> > Sorry to show my ignorance, but what are "historical objects"?
>> > Thanks!
>> >
>> > Kevin
>> >
>> > On 5/18/07, Ricardo Andere de Mello <[EMAIL PROTECTED]> wrote:
>> >>
>> >> ok, I'm sending this message to netmind list too, so they can
>> >> answer my
>> >> next
>> >> question too:
>> >>
>> >> * Maybe this is a silly question, but is it possible to place
>> >> netmind's
>> >> beankeeper historical structure between OpenJPA and the database
>> >> backstore?
>> >>
>> >> I dont think *any* serious commercial application can avoid
>> >> historical
>> >> objects.
>> >> I think netmind's beankeeper is a great thing, and JPA is a good
>> >> standard.
>> >> Mixing both projects would be very cool. ;-)
>> >>
>> >> []s, gandhi
>> >>
>> >>
>> >> 2007/5/18, Marc Prud'hommeaux <[EMAIL PROTECTED]>:
>> >> >
>> >> >
>> >> > Sadly, no. We don't have any built-in support for historical
>> >> support
>> >> > at this time, although we have thought for a long time that this
>> >> > would be a great feature to have.
>> >> >
>> >> > You can, of course, do it yourself manually with a bunch of
>> >> > persistent Date fields, but I agree that this is pretty
>> >> cumbersome to
>> >> > have to manage yourself.
>> >> >
>> >> >
>> >> >
>> >> > On May 18, 2007, at 11:27 AM, Ricardo Andere de Mello wrote:
>> >> >
>> >> > > Does OpenJPA have something similar to TopLink's
>> "AsOfClause" ?
>> >> > >
>> >> > > I've been working for some time with OJB and Hibernate, and
>> I'm
>> >> > > work a lot
>> >> > > with historical objects.
>> >> > > It really sucks to manage lots of classes to build a
>> historical
>> >> > > structure of
>> >> > > objects and object relations.
>> >> > >
>> >> > > Netminds beankeeper does a great job about this, but I'd
>> like to
>> >> > > adhere to
>> >> > > JPA...
>> >> > >
>> >> > > Any idea of implementing historical objects AND RELATIONS,
>> >> inside JPA?
>> >> > >
>> >> > > --
>> >> > > Ricardo Andere de Mello
>> >> > > Presidente do Quilombo Digital
>> >> > > 55 (11) 3271-7928 / 55 (11) 9917-7722
>> >> >
>> >> >
>> >>
>> >>
>> >> --
>> >> Ricardo Andere de Mello
>> >> Presidente do Quilombo Digital
>> >> 55 (11) 3271-7928 / 55 (11) 9917-7722
>> >>
>>
>>
>
>
> --
> Ricardo Andere de Mello
> Presidente do Quilombo Digital
> 55 (11) 3271-7928 / 55 (11) 9917-7722

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!

Re: Historical Session

2007-05-21 Thread Craig L Russell
As I've had it explained to me, you would not choose the time in a  
user-generated or user-visible query. Instead, the user would set the  
time and associate it with an EntityManager. The time is invisible to  
normal entity operations, including queries. For each query for a  
temporal object (the terminology I've heard) the EntityManager would  
include the appropriate WHERE clauses into the SQL that would select  
the proper instances based on the time.


So a find by primary key, navigation, or query would have the  
appropriate WHERE clauses generated with no action on the part of the  
user.


In the example below, the A instance doesn't need to worry about  
which B it refers to, because the B instances corresponding to A's  
time are also selected automatically, in that both A and B have  
corresponding temporal WHERE clauses based on the same time.


Craig

On May 21, 2007, at 3:16 PM, Ricardo Andere de Mello wrote:


yes this look something simple, but it is not...
see, objects exists in time, so for example, they are not deleted,  
they are

"finalized".
the worst part are the relationships, because they are historical  
too...
basically you have a start and end date for that object, and the  
object with

end date null is the actual object.
everytime you modify an object you clone it, set the end date of  
the old,

and set the start date of the new.
imagine now that "A" points to "B". both are historical objects. if  
"B" is
modified, a new historical object is created. "A" should point to  
the new
"B", not the old one. so you must have a "historical id" or a  
"historical id

object" to point at, that is common to all "B".

[]s, gandhi

2007/5/21, Marc Prud'hommeaux <[EMAIL PROTECTED]>:



Something like: "select x from Employee x as x was on January 1,  
2002"




On May 21, 2007, at 11:01 AM, Kevin Sutter wrote:

> Sorry to show my ignorance, but what are "historical objects"?
> Thanks!
>
> Kevin
>
> On 5/18/07, Ricardo Andere de Mello <[EMAIL PROTECTED]> wrote:
>>
>> ok, I'm sending this message to netmind list too, so they can
>> answer my
>> next
>> question too:
>>
>> * Maybe this is a silly question, but is it possible to place
>> netmind's
>> beankeeper historical structure between OpenJPA and the database
>> backstore?
>>
>> I dont think *any* serious commercial application can avoid
>> historical
>> objects.
>> I think netmind's beankeeper is a great thing, and JPA is a good
>> standard.
>> Mixing both projects would be very cool. ;-)
>>
>> []s, gandhi
>>
>>
>> 2007/5/18, Marc Prud'hommeaux <[EMAIL PROTECTED]>:
>> >
>> >
>> > Sadly, no. We don't have any built-in support for historical
>> support
>> > at this time, although we have thought for a long time that this
>> > would be a great feature to have.
>> >
>> > You can, of course, do it yourself manually with a bunch of
>> > persistent Date fields, but I agree that this is pretty
>> cumbersome to
>> > have to manage yourself.
>> >
>> >
>> >
>> > On May 18, 2007, at 11:27 AM, Ricardo Andere de Mello wrote:
>> >
>> > > Does OpenJPA have something similar to TopLink's  
"AsOfClause" ?

>> > >
>> > > I've been working for some time with OJB and Hibernate, and  
I'm

>> > > work a lot
>> > > with historical objects.
>> > > It really sucks to manage lots of classes to build a  
historical

>> > > structure of
>> > > objects and object relations.
>> > >
>> > > Netminds beankeeper does a great job about this, but I'd  
like to

>> > > adhere to
>> > > JPA...
>> > >
>> > > Any idea of implementing historical objects AND RELATIONS,
>> inside JPA?
>> > >
>> > > --
>> > > Ricardo Andere de Mello
>> > > Presidente do Quilombo Digital
>> > > 55 (11) 3271-7928 / 55 (11) 9917-7722
>> >
>> >
>>
>>
>> --
>> Ricardo Andere de Mello
>> Presidente do Quilombo Digital
>> 55 (11) 3271-7928 / 55 (11) 9917-7722
>>





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


Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!



smime.p7s
Description: S/MIME cryptographic signature


Re: Historical Session

2007-05-21 Thread Ricardo Andere de Mello

yes this look something simple, but it is not...
see, objects exists in time, so for example, they are not deleted, they are
"finalized".
the worst part are the relationships, because they are historical too...
basically you have a start and end date for that object, and the object with
end date null is the actual object.
everytime you modify an object you clone it, set the end date of the old,
and set the start date of the new.
imagine now that "A" points to "B". both are historical objects. if "B" is
modified, a new historical object is created. "A" should point to the new
"B", not the old one. so you must have a "historical id" or a "historical id
object" to point at, that is common to all "B".

[]s, gandhi

2007/5/21, Marc Prud'hommeaux <[EMAIL PROTECTED]>:



Something like: "select x from Employee x as x was on January 1, 2002"



On May 21, 2007, at 11:01 AM, Kevin Sutter wrote:

> Sorry to show my ignorance, but what are "historical objects"?
> Thanks!
>
> Kevin
>
> On 5/18/07, Ricardo Andere de Mello <[EMAIL PROTECTED]> wrote:
>>
>> ok, I'm sending this message to netmind list too, so they can
>> answer my
>> next
>> question too:
>>
>> * Maybe this is a silly question, but is it possible to place
>> netmind's
>> beankeeper historical structure between OpenJPA and the database
>> backstore?
>>
>> I dont think *any* serious commercial application can avoid
>> historical
>> objects.
>> I think netmind's beankeeper is a great thing, and JPA is a good
>> standard.
>> Mixing both projects would be very cool. ;-)
>>
>> []s, gandhi
>>
>>
>> 2007/5/18, Marc Prud'hommeaux <[EMAIL PROTECTED]>:
>> >
>> >
>> > Sadly, no. We don't have any built-in support for historical
>> support
>> > at this time, although we have thought for a long time that this
>> > would be a great feature to have.
>> >
>> > You can, of course, do it yourself manually with a bunch of
>> > persistent Date fields, but I agree that this is pretty
>> cumbersome to
>> > have to manage yourself.
>> >
>> >
>> >
>> > On May 18, 2007, at 11:27 AM, Ricardo Andere de Mello wrote:
>> >
>> > > Does OpenJPA have something similar to TopLink's "AsOfClause" ?
>> > >
>> > > I've been working for some time with OJB and Hibernate, and I'm
>> > > work a lot
>> > > with historical objects.
>> > > It really sucks to manage lots of classes to build a historical
>> > > structure of
>> > > objects and object relations.
>> > >
>> > > Netminds beankeeper does a great job about this, but I'd like to
>> > > adhere to
>> > > JPA...
>> > >
>> > > Any idea of implementing historical objects AND RELATIONS,
>> inside JPA?
>> > >
>> > > --
>> > > Ricardo Andere de Mello
>> > > Presidente do Quilombo Digital
>> > > 55 (11) 3271-7928 / 55 (11) 9917-7722
>> >
>> >
>>
>>
>> --
>> Ricardo Andere de Mello
>> Presidente do Quilombo Digital
>> 55 (11) 3271-7928 / 55 (11) 9917-7722
>>





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


Re: Historical Session

2007-05-21 Thread Marc Prud'hommeaux


Something like: "select x from Employee x as x was on January 1, 2002"



On May 21, 2007, at 11:01 AM, Kevin Sutter wrote:

Sorry to show my ignorance, but what are "historical objects"?   
Thanks!


Kevin

On 5/18/07, Ricardo Andere de Mello <[EMAIL PROTECTED]> wrote:


ok, I'm sending this message to netmind list too, so they can  
answer my

next
question too:

* Maybe this is a silly question, but is it possible to place  
netmind's

beankeeper historical structure between OpenJPA and the database
backstore?

I dont think *any* serious commercial application can avoid  
historical

objects.
I think netmind's beankeeper is a great thing, and JPA is a good  
standard.

Mixing both projects would be very cool. ;-)

[]s, gandhi


2007/5/18, Marc Prud'hommeaux <[EMAIL PROTECTED]>:
>
>
> Sadly, no. We don't have any built-in support for historical  
support

> at this time, although we have thought for a long time that this
> would be a great feature to have.
>
> You can, of course, do it yourself manually with a bunch of
> persistent Date fields, but I agree that this is pretty  
cumbersome to

> have to manage yourself.
>
>
>
> On May 18, 2007, at 11:27 AM, Ricardo Andere de Mello wrote:
>
> > Does OpenJPA have something similar to TopLink's "AsOfClause" ?
> >
> > I've been working for some time with OJB and Hibernate, and I'm
> > work a lot
> > with historical objects.
> > It really sucks to manage lots of classes to build a historical
> > structure of
> > objects and object relations.
> >
> > Netminds beankeeper does a great job about this, but I'd like to
> > adhere to
> > JPA...
> >
> > Any idea of implementing historical objects AND RELATIONS,  
inside JPA?

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


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





Re: Historical Session

2007-05-21 Thread Kevin Sutter

Sorry to show my ignorance, but what are "historical objects"?  Thanks!

Kevin

On 5/18/07, Ricardo Andere de Mello <[EMAIL PROTECTED]> wrote:


ok, I'm sending this message to netmind list too, so they can answer my
next
question too:

* Maybe this is a silly question, but is it possible to place netmind's
beankeeper historical structure between OpenJPA and the database
backstore?

I dont think *any* serious commercial application can avoid historical
objects.
I think netmind's beankeeper is a great thing, and JPA is a good standard.
Mixing both projects would be very cool. ;-)

[]s, gandhi


2007/5/18, Marc Prud'hommeaux <[EMAIL PROTECTED]>:
>
>
> Sadly, no. We don't have any built-in support for historical support
> at this time, although we have thought for a long time that this
> would be a great feature to have.
>
> You can, of course, do it yourself manually with a bunch of
> persistent Date fields, but I agree that this is pretty cumbersome to
> have to manage yourself.
>
>
>
> On May 18, 2007, at 11:27 AM, Ricardo Andere de Mello wrote:
>
> > Does OpenJPA have something similar to TopLink's "AsOfClause" ?
> >
> > I've been working for some time with OJB and Hibernate, and I'm
> > work a lot
> > with historical objects.
> > It really sucks to manage lots of classes to build a historical
> > structure of
> > objects and object relations.
> >
> > Netminds beankeeper does a great job about this, but I'd like to
> > adhere to
> > JPA...
> >
> > Any idea of implementing historical objects AND RELATIONS, inside JPA?
> >
> > --
> > Ricardo Andere de Mello
> > Presidente do Quilombo Digital
> > 55 (11) 3271-7928 / 55 (11) 9917-7722
>
>


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



Re: Historical Session

2007-05-18 Thread Ricardo Andere de Mello

ok, I'm sending this message to netmind list too, so they can answer my next
question too:

* Maybe this is a silly question, but is it possible to place netmind's
beankeeper historical structure between OpenJPA and the database backstore?

I dont think *any* serious commercial application can avoid historical
objects.
I think netmind's beankeeper is a great thing, and JPA is a good standard.
Mixing both projects would be very cool. ;-)

[]s, gandhi


2007/5/18, Marc Prud'hommeaux <[EMAIL PROTECTED]>:



Sadly, no. We don't have any built-in support for historical support
at this time, although we have thought for a long time that this
would be a great feature to have.

You can, of course, do it yourself manually with a bunch of
persistent Date fields, but I agree that this is pretty cumbersome to
have to manage yourself.



On May 18, 2007, at 11:27 AM, Ricardo Andere de Mello wrote:

> Does OpenJPA have something similar to TopLink's "AsOfClause" ?
>
> I've been working for some time with OJB and Hibernate, and I'm
> work a lot
> with historical objects.
> It really sucks to manage lots of classes to build a historical
> structure of
> objects and object relations.
>
> Netminds beankeeper does a great job about this, but I'd like to
> adhere to
> JPA...
>
> Any idea of implementing historical objects AND RELATIONS, inside JPA?
>
> --
> Ricardo Andere de Mello
> Presidente do Quilombo Digital
> 55 (11) 3271-7928 / 55 (11) 9917-7722





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


Re: Historical Session

2007-05-18 Thread Marc Prud'hommeaux


Sadly, no. We don't have any built-in support for historical support  
at this time, although we have thought for a long time that this  
would be a great feature to have.


You can, of course, do it yourself manually with a bunch of  
persistent Date fields, but I agree that this is pretty cumbersome to  
have to manage yourself.




On May 18, 2007, at 11:27 AM, Ricardo Andere de Mello wrote:


Does OpenJPA have something similar to TopLink's "AsOfClause" ?

I've been working for some time with OJB and Hibernate, and I'm  
work a lot

with historical objects.
It really sucks to manage lots of classes to build a historical  
structure of

objects and object relations.

Netminds beankeeper does a great job about this, but I'd like to  
adhere to

JPA...

Any idea of implementing historical objects AND RELATIONS, inside JPA?

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