ABOU LINA wrote:
i think the coste of using ODMG is very big only looking  how in ODMG we
query an object. in ODMG it use OQL (like SQL synthaxis where ....) so is
very diferent to PB wiche use Criteria  to build a condition !!!!!

what do you think Mr Armine


As said in my other post, it's possible to use the PB-api (with Criteria based queries) within ODMG and additionally you can tweak the odmg implementation:
- Disable implicit locking (lock all objects before modify them by hand)
- Disable pessimistic (object) locking and use optimistic locking for critical objects
http://db.apache.org/ojb/docu/guides/lockmanager.html

regards,
Armin

On 3/9/06, ABOU LINA <[EMAIL PROTECTED]> wrote:
Hi,

ok so, i made DAO implementation with OJB PB in a critical project  and
we are in step of delivring some module of the application (the mainly
module now are developped and tested). my question is :

1. what will be the cost of migrating from PB to ODMG. ???
2. there are some tools making  this  migration easy and fast ???
3. in your opinion, the probleme about deleting collection elements
justify using ODMG instead of PB ???
4. Best practice of ODMG and good examples ??


Thanks.



On 3/9/06, Armin Waibel <[EMAIL PROTECTED]> wrote:
Hi,

ABOU LINA wrote:
thank first,

PersistenceBroker *delete elements* from the database that have been
removed
from the collection only if i do this :
for example : A 1:n B
1. i get A from database using OJB Broker.
2. i delete one element B from A : A.getBCollection().remove(o);

in this case yes the PB delete the element from database . but in
generale
we don't
invoke remove but we construct a new collection and we set it :
1. get A from database.
2. Collection bCol = new ArrayList();
    A.setBCollection(bCol);

in this case the element that not figure in bCol are not deleted
because i
use ArrayList. (in my Application i can't put RemovalAwareList
directly

There is no need to handle with RemovalAwareList instances in your
POJO's. Using type 'List' is sufficient and on insert of new objects you

can use ArrayList, so

2. Collection bCol = new ArrayList();
    A.setBCollection(bCol);
is valid when insert new objects.
But you are right, when updating objects you have to use
Collection.remove (...) method.
2. i delete one element B from A : A.getBCollection().remove(o);
it's not allowed to replace the old List with a sub-List instance.


inorder to keep the application independent of OJB classes ...)

so what is the solution please ... without using ODMG ?????
There is none.
That's the main difference between the PB-api and ODMG. The ODMG
implementation use a "Unit of work" pattern (object state detection,
detection of new/deleted objects) the PB-api does immediately write
objects to DB and does not keep the objects state "in mind".

For the next major release of OJB we plan to extend the PB-api to
support a "unit of work" pattern with locking.

regards,
Armin

Thanks

On 3/7/06, Armin Waibel <[EMAIL PROTECTED]> wrote:
Hi,

ABOU LINA wrote:
Hi,
in ojb document :
---------------------------------------
Say you use the PB to query an object O that has a collection
attribute
col
with five
elements a,b,c,d,e. Next you delete Objects d and e from col and
store O
again with
PersistenceBroker.store(O);
PB will store the remaining objects a,b,c. But it will not delete d
and
e !
If you then
requery object O it will again contain a,b,c,d,e !!!
--------------------

i ask if the new version of PB (1.0.4) still behave like this ???
Oops! Seems you found some outdated documentation - I will fix this
till
next release.
With corresponding settings OJB 1.0.4 is able to detect the deleted
objects of the 1:n reference. More info see


http://db.apache.org/ojb/docu/guides/basic-technique.html#1%3An+auto-xxx+setting

http://db.apache.org/ojb/docu/guides/advanced-technique.html#which-collection-type
regards,
Armin



---------------------------------------------------------------------
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]




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

Reply via email to