Hi Dennis,

Dennis Bekkering wrote:
Hello all,

I am almost there with regards to asynq data merging based upon GUID. What i
am looking for now is a way to have a creationdate field in
indirectiontables. I am not sure how to do this since it is all handled by
OJB.

If you need an additional field in indirection table you can't use non-decomposed m:n relation.


The case is like this, a local server has records that are not present in
the main server. It is either a new local record or a deleted global one. I
can discover what it is if i know the last synqdate of the localserver. If
the lastsynq date is after the creationdate of the local record then the
global record is deleted and the local record should also be deleted, if the
lastsynq is before the creationdate then the local record is new and should
be send to the main server. I can control every record's creationdate except
for the indirecttable ones.

To make this possible (OJB populate an additional timestamp column in indirection table on insert) with non-decomposed m:n relation you have to modify/extend OJB. If each indirection table has a additional column TIME_STAMP you can modify the creation of m:n insert statement. In this case you have to implement your own SqlGenerator class (extend existing default and override #getInsertMNStatement) and MtoNBroker class (override insert methods)... this will be complicated.

I don't know an easy solution for your problem.
If the timeframe between two synchronization calls is greater then seconds and you don't need millisecond precision of timestamp values you can try to update the indirection table entries after OJB insert/update the entries. You can use plain SQL or you can define a persistence capable object for each indirection table and after insert/update you request all rows with empty timestamp column, set the timestamp and update the indirection table objects.

regards,
Armin




regards,
Dennis



2006/4/25, Armin Waibel <[EMAIL PROTECTED]>:

Hi Dennis,

to use OJB's auto-increment feature (automatic assignment of PK's) you
have to implement a SequenceManager based on class GUIDFactory.

Simply extend AbstractSequenceManager and override
public Object getUniqueValue(...)

Implement
protected int getUniqueId(...)
and throw exception within this method (see SequenceManagerMSSQLGuidImpl).

regards,
Armin


Dennis Bekkering wrote:
> great, thanks!
>
> 2006/4/24, Thomas Mahler <[EMAIL PROTECTED]>:
>> Hi Dennis,
>>
>> org.apache.ojb.broker.util.GUIDFactory produces GUIDs that are unique
>> across different VMs.
>>
>> cheers,
>> Thomas
>>
>> Dennis Bekkering wrote:
>>> Hello all,
>>>
>>> I have a situation where i frequently have to merge data from
different
>>> databases. Uptill now every database has it's own sequence. That means
>> that
>>> i cannot merge the data blindly because two records with the same id
>> might
>>> not be the same record. I am thinking of switching from int id's to
>> varchar
>>> UID's. Does ojb support such mechanism in an offline manner, so that
the
>> two
>>> servers do not need to communicate with each other. If all id's are
>> globally
>>> unique i can blindly merge data without the danger of overwriting
stuff.
>> If
>>> ojb does not offer this out of the box then does anybody now a way to
>>> generate UID's across systems. Within one system I use
>>> java.rmi.server.UID().toString()
>>> but i dont know how unique that is across different VM's.
>>>
>>> Cheers,
>>> Dennis
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> --
> mvg,
> Dennis
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to