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 Guillaume Nodet <gu...@deliasystems.com> on 2004/04/23 16:24:36 UTC
Problem with sequence manager
Hi,
In my application, i can dynamically create and drop the tables
for storing ojb objects. The problem is that when i insert some
data, drop the tables, recreate them, and insert data, the sequence
manager is not re-initialized (i use SequenceManagerHighLowImpl)
so when inserting data in the newly created tables, the sequence
manager reuses caches sequences (in the sequencesMap), instead
of creating new ones. So when a sequence runs out of id, it looks
into the database, creates a new sequence and thus ids overlapp.
Could it be possible to add a method for clearing the cache of
sequences (stored in the sequencesMap attribute) ?
I will for the moment use my own sequence manager (a copy of
SequenceManagerHighLowImpl with the above method).
Thanks,
Guillaume
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
RE: Problem with sequence manager
Posted by Guillaume Nodet <gu...@deliasystems.com>.
It should be ok.
The reset name seems fine to me.
Thanks,
Guillaume
-----Message d'origine-----
De : Armin Waibel [mailto:arminw@apache.org]
Envoyé : vendredi 23 avril 2004 18:08
À : OJB Users List
Objet : Re: Problem with sequence manager
Guillaume Nodet wrote:
> I only added the following method:
>
> public static void clearCache() {
> if (sequencesMap != null) {
> sequencesMap.clear();
> }
> }
>
It should be no problem to add such a method, but I can't change the
sequence manager interface (maybe for 1.1), so you have to cast. Maybe
we call the method 'reset()' and introduce this method in sequence
manager interface for 1.1.
In reset() method depended on the implementation the sequence manager
was set to an initial state.
What do you think? Better method name?
regards,
Armin
> and called it when i destroy the tables, and everything
> works fine now.
>
> -----Message d'origine-----
> De : Guillaume Nodet [mailto:guillaume.nodet@deliasystems.com]
> Envoyé : vendredi 23 avril 2004 16:25
> À : OJB Users List
> Objet : Problem with sequence manager
>
>
> Hi,
>
> In my application, i can dynamically create and drop the tables
> for storing ojb objects. The problem is that when i insert some
> data, drop the tables, recreate them, and insert data, the sequence
> manager is not re-initialized (i use SequenceManagerHighLowImpl)
> so when inserting data in the newly created tables, the sequence
> manager reuses caches sequences (in the sequencesMap), instead
> of creating new ones. So when a sequence runs out of id, it looks
> into the database, creates a new sequence and thus ids overlapp.
>
> Could it be possible to add a method for clearing the cache of
> sequences (stored in the sequencesMap attribute) ?
>
> I will for the moment use my own sequence manager (a copy of
> SequenceManagerHighLowImpl with the above method).
>
> Thanks,
>
> Guillaume
>
> ---------------------------------------------------------------------
> 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
>
>
>
---------------------------------------------------------------------
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: Problem with sequence manager
Posted by Armin Waibel <ar...@apache.org>.
Guillaume Nodet wrote:
> I only added the following method:
>
> public static void clearCache() {
> if (sequencesMap != null) {
> sequencesMap.clear();
> }
> }
>
It should be no problem to add such a method, but I can't change the
sequence manager interface (maybe for 1.1), so you have to cast. Maybe
we call the method 'reset()' and introduce this method in sequence
manager interface for 1.1.
In reset() method depended on the implementation the sequence manager
was set to an initial state.
What do you think? Better method name?
regards,
Armin
> and called it when i destroy the tables, and everything
> works fine now.
>
> -----Message d'origine-----
> De : Guillaume Nodet [mailto:guillaume.nodet@deliasystems.com]
> Envoyé : vendredi 23 avril 2004 16:25
> À : OJB Users List
> Objet : Problem with sequence manager
>
>
> Hi,
>
> In my application, i can dynamically create and drop the tables
> for storing ojb objects. The problem is that when i insert some
> data, drop the tables, recreate them, and insert data, the sequence
> manager is not re-initialized (i use SequenceManagerHighLowImpl)
> so when inserting data in the newly created tables, the sequence
> manager reuses caches sequences (in the sequencesMap), instead
> of creating new ones. So when a sequence runs out of id, it looks
> into the database, creates a new sequence and thus ids overlapp.
>
> Could it be possible to add a method for clearing the cache of
> sequences (stored in the sequencesMap attribute) ?
>
> I will for the moment use my own sequence manager (a copy of
> SequenceManagerHighLowImpl with the above method).
>
> Thanks,
>
> Guillaume
>
> ---------------------------------------------------------------------
> 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
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
RE: Problem with sequence manager
Posted by Guillaume Nodet <gu...@deliasystems.com>.
I only added the following method:
public static void clearCache() {
if (sequencesMap != null) {
sequencesMap.clear();
}
}
and called it when i destroy the tables, and everything
works fine now.
-----Message d'origine-----
De : Guillaume Nodet [mailto:guillaume.nodet@deliasystems.com]
Envoyé : vendredi 23 avril 2004 16:25
À : OJB Users List
Objet : Problem with sequence manager
Hi,
In my application, i can dynamically create and drop the tables
for storing ojb objects. The problem is that when i insert some
data, drop the tables, recreate them, and insert data, the sequence
manager is not re-initialized (i use SequenceManagerHighLowImpl)
so when inserting data in the newly created tables, the sequence
manager reuses caches sequences (in the sequencesMap), instead
of creating new ones. So when a sequence runs out of id, it looks
into the database, creates a new sequence and thus ids overlapp.
Could it be possible to add a method for clearing the cache of
sequences (stored in the sequencesMap attribute) ?
I will for the moment use my own sequence manager (a copy of
SequenceManagerHighLowImpl with the above method).
Thanks,
Guillaume
---------------------------------------------------------------------
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