Re: PB behavor of Collection item delete ?
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 inorder to keep the application independent of OJB classes ...) so what is the solution please ... without using ODMG ? 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]
Re: PB behavor of Collection item delete ?
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]
Re: PB behavor of Collection item delete ?
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]
Re: PB behavor of Collection item delete ?
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 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]
Re: PB behavor of Collection item delete ?
Hi, ABOU LINA 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. ??? There is no need to completely migrate to ODMG. For all read-only operations the PB-api can still be used without modification. For all insert/update/delete operations use the ODMG-api. Anyway it is possible to use the PB-api within the odmg-api, so there is no need to use OQL-queries within odmg-tx http://db.apache.org/ojb/docu/guides/odmg-guide.html#Access+the+PB-api+within+ODMG All objects read by the PB instance have to be locked *before* you start to modify these objects. http://db.apache.org/ojb/docu/guides/odmg-guide.html#I+don%27t+like+OQL%2C+can+I+use+the+PersistenceBroker+Queries+within+ODMG When using OQL-queries by default OJB lock all received objects, see 'implicit locking' section http://db.apache.org/ojb/docu/guides/odmg-guide.html#Configuration+Properties http://db.apache.org/ojb/docu/guides/odmg-guide.html#The+TransactionExt+Interface But take care not to use PB instances looked up from the PBF within a odmg-tx. 2. there are some tools making this migration easy and fast ??? Sorry, there is no tool. But in the metadata files you only have to change the auto-xxx settings of your references http://db.apache.org/ojb/docu/guides/odmg-guide.html#Specific+Metadata+Settings 3. in your opinion, the probleme about deleting collection elements justify using ODMG instead of PB ??? This depends on your requirements. If you need this behavior 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); then you have to use the odmg-api. 4. Best practice of ODMG and good examples ?? Have a look in the ODMG tutorial, the odmg-guide and in OJB's test-suite classes for the ODMG-api. http://db.apache.org/ojb/docu/tutorials/odmg-tutorial.html http://svn.apache.org/viewcvs.cgi/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/?rev=378044 Sorry, best practice is missing. regards, Armin 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
Re: PB behavor of Collection item delete ?
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]
PB behavor of Collection item delete ?
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 ???
Re: PB behavor of Collection item delete ?
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]