Re: 1:m-relation
BTW.. i am using the OJB api. Nothing special being done. And my application for the most part is probably only going to need 1-M and 1-1 type mappings so i am not trying to do anything fancy. I have no problem creating the initial objects.. ie.. if i create A then add 10 B objects to the vector of Bs and then save, creation works perfectly. The problem is UPDATES. if i read out the A then add one more B object to its collection for a total of 11 B objects then i call the store in the same way, i find that the new one was not saved. I will double check my configs again and see. thanks for all your help James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 7/9/2003 12:42:09 PM >>> Hi! The persistence should occur automatically when auto-update=true, even using Vectors. Are you working with OJB Api, ODBC or JDO? The samples I've shown uses OJB Api. And of course, I use transactions... (or I store A and all instances of B, or don't store anything. This is a must when working with large apps). Maybe someone else can point you with more information... All that I can tell you is that this work. When I started with OJB I've used the samples, and they work. Maybe you have missing something in configuration. About the RemovalAwareCollection, you should use only if you need the instances of B being removed when you store A... Nothing about auto-update inserting objects. []s Edson Richter - Original Message - From: "James Nyika" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 09, 2003 11:03 AM Subject: Re: 1:m-relation Edson, see this is very interesting because i do not use any special collection class. I use a simple vector. When i do the stuff you are describing below, my new B object is not being created in the database, EVEN with my auto-update set to true. If i change anything on the A object, the change is recognized and saved. However, if i add or remove any objects from the collection of B objects, it is as through the change is not recognized. Should i start using the RemovalAwareCollection in order to make sure that any additions or deletions to the vector ? Note: the difference between what i showed below and the examples that come with OJB is that OJB examples always show the changes being made in the context of a broker transaction. I am not sure if this matters, but the way i am writing my interface to the persistence broker, i would like to be able to read objects out of the database, update them at will outside of broker transaction contexts, then bring the same references back and save the altered objects back to the database. any help you can provide would be helpful James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 7/9/2003 6:31:08 AM >>> Yes, exactly what I do. But see, to B instances be stored in database, you must put auto-update='true' in your collection descriptor. In real, I use a collection class RemovalAwareCollection (or a specialized RemovalAwareList that I've created) to auto-delete. So, if I a.getCol().remove( 0 ); broker.store(a); the item in 0 is deleted from database, as expected. This is a must for my app. Best regards, Edson Richter - Original Message - From: "James Nyika" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 08, 2003 4:46 PM Subject: Re: 1:m-relation Edson, Can i ask you to give an example of how you add more B objects the the collection you described below do you do something like this : //get broker broker = brokerfactory.defaultInstance(); //fetch an A object that has say 3 B objects in the collection. ... //create a new B object B newB = new B(); //add to the collection A.getCol().add(newB); //persist the A broker.beginTransaction(); broker.store(A); broker.commitTransaction(); ? James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 7/8/2003 12:24:28 PM >>> Hi! I'm largelly using 1:N and M:N relationships in my project. I'll try to give you a little tips: 1) Use your N parts as Collection. If you are using PersistentFieldPropertyImpl, then you should have public class A { private Collection myNpart; private Integer id; public void setId( Integer newId ) { id = newId; } public Integer getId( ) {return id;} public void setCol( Collection newCol ) { myNpart = newCol; } public Collection getCol( ) { return myNpart; } } public class B { private Integer id; private Integer idA; private A a; public void setId( Integer newId ) { id = newId; } public Integer getId( ) {return id;} public void setIdA( Integer newIdA ) { idA = newIdA; } public Int
Re: 1:m-relation
Thanks Edson I will probably start using the RemovalAwareCollection because i do need to be able to detect objects that have been removed from the vector of B objects. So that is one change that i will at least have to make. And then i will review the code i have with the knowledge that what we described should work. thanks very much. james James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 7/9/2003 12:42:09 PM >>> Hi! The persistence should occur automatically when auto-update=true, even using Vectors. Are you working with OJB Api, ODBC or JDO? The samples I've shown uses OJB Api. And of course, I use transactions... (or I store A and all instances of B, or don't store anything. This is a must when working with large apps). Maybe someone else can point you with more information... All that I can tell you is that this work. When I started with OJB I've used the samples, and they work. Maybe you have missing something in configuration. About the RemovalAwareCollection, you should use only if you need the instances of B being removed when you store A... Nothing about auto-update inserting objects. []s Edson Richter - Original Message - From: "James Nyika" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 09, 2003 11:03 AM Subject: Re: 1:m-relation Edson, see this is very interesting because i do not use any special collection class. I use a simple vector. When i do the stuff you are describing below, my new B object is not being created in the database, EVEN with my auto-update set to true. If i change anything on the A object, the change is recognized and saved. However, if i add or remove any objects from the collection of B objects, it is as through the change is not recognized. Should i start using the RemovalAwareCollection in order to make sure that any additions or deletions to the vector ? Note: the difference between what i showed below and the examples that come with OJB is that OJB examples always show the changes being made in the context of a broker transaction. I am not sure if this matters, but the way i am writing my interface to the persistence broker, i would like to be able to read objects out of the database, update them at will outside of broker transaction contexts, then bring the same references back and save the altered objects back to the database. any help you can provide would be helpful James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 7/9/2003 6:31:08 AM >>> Yes, exactly what I do. But see, to B instances be stored in database, you must put auto-update='true' in your collection descriptor. In real, I use a collection class RemovalAwareCollection (or a specialized RemovalAwareList that I've created) to auto-delete. So, if I a.getCol().remove( 0 ); broker.store(a); the item in 0 is deleted from database, as expected. This is a must for my app. Best regards, Edson Richter - Original Message - From: "James Nyika" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 08, 2003 4:46 PM Subject: Re: 1:m-relation Edson, Can i ask you to give an example of how you add more B objects the the collection you described below do you do something like this : //get broker broker = brokerfactory.defaultInstance(); //fetch an A object that has say 3 B objects in the collection. ... //create a new B object B newB = new B(); //add to the collection A.getCol().add(newB); //persist the A broker.beginTransaction(); broker.store(A); broker.commitTransaction(); ? James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 7/8/2003 12:24:28 PM >>> Hi! I'm largelly using 1:N and M:N relationships in my project. I'll try to give you a little tips: 1) Use your N parts as Collection. If you are using PersistentFieldPropertyImpl, then you should have public class A { private Collection myNpart; private Integer id; public void setId( Integer newId ) { id = newId; } public Integer getId( ) {return id;} public void setCol( Collection newCol ) { myNpart = newCol; } public Collection getCol( ) { return myNpart; } } public class B { private Integer id; private Integer idA; private A a; public void setId( Integer newId ) { id = newId; } public Integer getId( ) {return id;} public void setIdA( Integer newIdA ) { idA = newIdA; } public Integer getIdA( ) {return idA;} public void setA( A newA ) { a = newA; } public A getA( ) { return a; } } 2) Your .xml should be similar to: And this should work. You don't need to specify auto
Re: 1:m-relation
Edson, see this is very interesting because i do not use any special collection class. I use a simple vector. When i do the stuff you are describing below, my new B object is not being created in the database, EVEN with my auto-update set to true. If i change anything on the A object, the change is recognized and saved. However, if i add or remove any objects from the collection of B objects, it is as through the change is not recognized. Should i start using the RemovalAwareCollection in order to make sure that any additions or deletions to the vector ? Note: the difference between what i showed below and the examples that come with OJB is that OJB examples always show the changes being made in the context of a broker transaction. I am not sure if this matters, but the way i am writing my interface to the persistence broker, i would like to be able to read objects out of the database, update them at will outside of broker transaction contexts, then bring the same references back and save the altered objects back to the database. any help you can provide would be helpful James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 7/9/2003 6:31:08 AM >>> Yes, exactly what I do. But see, to B instances be stored in database, you must put auto-update='true' in your collection descriptor. In real, I use a collection class RemovalAwareCollection (or a specialized RemovalAwareList that I've created) to auto-delete. So, if I a.getCol().remove( 0 ); broker.store(a); the item in 0 is deleted from database, as expected. This is a must for my app. Best regards, Edson Richter - Original Message - From: "James Nyika" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 08, 2003 4:46 PM Subject: Re: 1:m-relation Edson, Can i ask you to give an example of how you add more B objects the the collection you described below do you do something like this : //get broker broker = brokerfactory.defaultInstance(); //fetch an A object that has say 3 B objects in the collection. ... //create a new B object B newB = new B(); //add to the collection A.getCol().add(newB); //persist the A broker.beginTransaction(); broker.store(A); broker.commitTransaction(); ? James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 7/8/2003 12:24:28 PM >>> Hi! I'm largelly using 1:N and M:N relationships in my project. I'll try to give you a little tips: 1) Use your N parts as Collection. If you are using PersistentFieldPropertyImpl, then you should have public class A { private Collection myNpart; private Integer id; public void setId( Integer newId ) { id = newId; } public Integer getId( ) {return id;} public void setCol( Collection newCol ) { myNpart = newCol; } public Collection getCol( ) { return myNpart; } } public class B { private Integer id; private Integer idA; private A a; public void setId( Integer newId ) { id = newId; } public Integer getId( ) {return id;} public void setIdA( Integer newIdA ) { idA = newIdA; } public Integer getIdA( ) {return idA;} public void setA( A newA ) { a = newA; } public A getA( ) { return a; } } 2) Your .xml should be similar to: And this should work. You don't need to specify auto-retrieve, because by default it's true. Auto-update and auto-delete are false by default. Some people like to work with specialized collection classes. In particular, I work always with RemovalAwareList (a collection that know how to persists deletes in the collection). To archieve this, your should be more specific in collection descriptor like this: Of course, you could mixes the several other options that OJB offers to you, like auto-increment, proxies and so on. In this case, I'll recomendly you to use cvs HEAD that has several fixes for these options over rc3. Best regards, Edson Richter - Original Message - From: "Christian Eugster" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, July 07, 2003 11:31 AM Subject: 1:m-relation i am working on a mysql-database and ojb rc3. i have an 1:m-relation with the following setting in the collection-desriptor of the parent object: auto-retrieve="true" when i try to retrieve an parent-object i get the error-message as follows: (setting auto-retrieve to false there is no error). what am i doing wrong? java.lang.IllegalArgumentException at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl. java:63) at java.lang.reflect.Field.set(Field.java:519) at org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl.set(Un known Source) at org.apache.ojb.broker.cor
Re: 1:m-relation
Edson, Can i ask you to give an example of how you add more B objects the the collection you described below do you do something like this : //get broker broker = brokerfactory.defaultInstance(); //fetch an A object that has say 3 B objects in the collection. ... //create a new B object B newB = new B(); //add to the collection A.getCol().add(newB); //persist the A broker.beginTransaction(); broker.store(A); broker.commitTransaction(); ? James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 7/8/2003 12:24:28 PM >>> Hi! I'm largelly using 1:N and M:N relationships in my project. I'll try to give you a little tips: 1) Use your N parts as Collection. If you are using PersistentFieldPropertyImpl, then you should have public class A { private Collection myNpart; private Integer id; public void setId( Integer newId ) { id = newId; } public Integer getId( ) {return id;} public void setCol( Collection newCol ) { myNpart = newCol; } public Collection getCol( ) { return myNpart; } } public class B { private Integer id; private Integer idA; private A a; public void setId( Integer newId ) { id = newId; } public Integer getId( ) {return id;} public void setIdA( Integer newIdA ) { idA = newIdA; } public Integer getIdA( ) {return idA;} public void setA( A newA ) { a = newA; } public A getA( ) { return a; } } 2) Your .xml should be similar to: And this should work. You don't need to specify auto-retrieve, because by default it's true. Auto-update and auto-delete are false by default. Some people like to work with specialized collection classes. In particular, I work always with RemovalAwareList (a collection that know how to persists deletes in the collection). To archieve this, your should be more specific in collection descriptor like this: Of course, you could mixes the several other options that OJB offers to you, like auto-increment, proxies and so on. In this case, I'll recomendly you to use cvs HEAD that has several fixes for these options over rc3. Best regards, Edson Richter - Original Message - From: "Christian Eugster" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, July 07, 2003 11:31 AM Subject: 1:m-relation i am working on a mysql-database and ojb rc3. i have an 1:m-relation with the following setting in the collection-desriptor of the parent object: auto-retrieve="true" when i try to retrieve an parent-object i get the error-message as follows: (setting auto-retrieve to false there is no error). what am i doing wrong? java.lang.IllegalArgumentException at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl. java:63) at java.lang.reflect.Field.set(Field.java:519) at org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl.set(Un known Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow n Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow n Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow n Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknow n Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQuery( Unknown Source) at ch.eugster.pos.db.Receipt.getReceiptsByUserState(Receipt.java:183) at ch.eugster.pos.client.gui.ReceiptTableBlock.loadReceipts(ReceiptTableBlock.j ava:58) at ch.eugster.pos.client.gui.ReceiptTableBlock.init(ReceiptTableBlock.java:50) at ch.eugster.pos.client.gui.ReceiptTableBlock.(ReceiptTableBlock.java:39 ) at ch.eugster.pos.client.gui.ChildrenBlock.init(ChildrenBlock.java:34) at ch.eugster.pos.client.gui.ChildrenBlock.(ChildrenBlock.java:28) at ch.eugster.pos.client.gui.UserPanel.init(UserPanel.java:58) at ch.eugster.pos.client.gui.UserPanel.(UserPanel.java:39) at ch.eugster.pos.client.gui.TabPanel.addUser(TabPanel.java:67) at ch.eugster.pos.client.gui.TabPanel.userLoggedIn(TabPanel.java:126) at ch.eugster.pos.client.gui.LoginPanel.fireLoginEvent(LoginPanel.java:99) at ch.eugster.pos.client.gui.LoginPanel.actionPerformed(LoginPanel.java:90) at ch.eugster.pos.client.gui.LoginBlock.fireActionEvent(LoginBlock.java:197) at ch.eugster.pos.client.gui.LoginBlock.keyPressed(LoginBlock.java:156) at java.awt.Component.processKeyEvent(Component.java:5051) at javax.swing.JComponent.processKeyEvent(JComponent.java:2385) at java.awt.Com
RE: Changing contents of a 1:n Collection Doesn't Seem to Work
Jack -so the reference descriptor is not necessary in a 1-m ? ... you example below is a little confusing. -is the child pk a foreign key also ? -on the Sku object... what is skuId ? did you mean this to be the "id" field ? also.. could you tell us what you do in code to actually add a Child object to the Sku object.. even pseudo code would do. j James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 6/11/2003 2:07:33 PM >>> Thanks James & John - Here is the section: -Original Message- From: James Nyika [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 1:24 PM To: [EMAIL PROTECTED] Subject: RE: Changing contents of a 1:n Collection Doesn't Seem to Work Hi All, Yeah.. need to see that repository_user.xml I have been having this problem for a while too. I noticed that: if auto-delete and auto-update are set: 1. Creates always work fine.. if there are objects in the collection, then they are successfully created. 2. If you search for the newly created object, get the collection, add yet another new child object and attempt to store, it does not work. 3. Neither does doing the same in 2 except that you remove an existing child However, having said that, the following does work 1. Perform step 1 above. 2. Create a new child object and call store() on it alone. 3. Read the parent, object and voila! : it is magically in the collection. but this beats the whole point of using OJB. below is MY repository_user.xml (notice- i do not have a reference-descriptor in the child! do i need this ?) thanks - descriptor start--- descriptor end--------- -- James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 6/11/2003 12:33:33 PM >>> post your repository_user.xml do you have auto-delete=true and auto-update= true on your collection-descriptor? -Original Message- From: Jack Collins [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 11:29 AM To: [EMAIL PROTECTED] Subject: Changing contents of a 1:n Collection Doesn't Seem to Work I have an object that has a collection as one of its properties. I can create the object, add members to the collection and save it with no problem. If I check the contents of the database I see the parent object and all of its children. If I retrieve that same object and remove one of the child objects in the collection and save the parent again, the changes to the collection are not reflected in the database. It seems like OJB is only capable of adding to the contents of a collection but not removing them. When I turned on the logging of the SqlGeneratorDefaultImpl I can see insert and update statements, but never a delete statement to handle the removal of the child from the collection. I am using RC3 and have tried using a few different cache implementations (ObjectCachePerBrokerImpl, ObjectCacheDefaultImpl, ObjectCacheEmptyImpl) but always get the same result. What am I missing? - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: any examples with OJB 1.0
glauber, does this line jcd-alias="@JCD_ALIAS@" allow you to specify the alias name through environment variables ? thanks James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 6/11/2003 1:36:24 PM >>> Here is mine, with MySQL - Original Message - From: "James Nyika" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 11, 2003 2:29 PM Subject: Re: any examples with OJB 1.0 Jorge To use a different db other than Hsql you can need to change the repository_database.xml setting. here is mine going against SAPDB >>> [EMAIL PROTECTED] 6/11/2003 12:46:13 PM >>> Hi Somebody has a complete example with OJB 1.0 using ODMG with another data base that is not Hsql. I am needing one urgent one thanks Jorge ivan Marmolejo Java Engineer Universidad de San Buenaventura [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] _ Charla con tus amigos en línea mediante MSN Messenger: http://messenger.yupimsn.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com - 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]
Re: any examples with OJB 1.0
Jorge To use a different db other than Hsql you can need to change the repository_database.xml setting. here is mine going against SAPDB >>> [EMAIL PROTECTED] 6/11/2003 12:46:13 PM >>> Hi Somebody has a complete example with OJB 1.0 using ODMG with another data base that is not Hsql. I am needing one urgent one thanks Jorge ivan Marmolejo Java Engineer Universidad de San Buenaventura [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] _ Charla con tus amigos en línea mediante MSN Messenger: http://messenger.yupimsn.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Changing contents of a 1:n Collection Doesn't Seem to Work
Hi All, Yeah.. need to see that repository_user.xml I have been having this problem for a while too. I noticed that: if auto-delete and auto-update are set: 1. Creates always work fine.. if there are objects in the collection, then they are successfully created. 2. If you search for the newly created object, get the collection, add yet another new child object and attempt to store, it does not work. 3. Neither does doing the same in 2 except that you remove an existing child However, having said that, the following does work 1. Perform step 1 above. 2. Create a new child object and call store() on it alone. 3. Read the parent, object and voila! : it is magically in the collection. but this beats the whole point of using OJB. below is MY repository_user.xml (notice- i do not have a reference-descriptor in the child! do i need this ?) thanks - descriptor start--- descriptor end--- James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 6/11/2003 12:33:33 PM >>> post your repository_user.xml do you have auto-delete=true and auto-update= true on your collection-descriptor? -Original Message- From: Jack Collins [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 11, 2003 11:29 AM To: [EMAIL PROTECTED] Subject: Changing contents of a 1:n Collection Doesn't Seem to Work I have an object that has a collection as one of its properties. I can create the object, add members to the collection and save it with no problem. If I check the contents of the database I see the parent object and all of its children. If I retrieve that same object and remove one of the child objects in the collection and save the parent again, the changes to the collection are not reflected in the database. It seems like OJB is only capable of adding to the contents of a collection but not removing them. When I turned on the logging of the SqlGeneratorDefaultImpl I can see insert and update statements, but never a delete statement to handle the removal of the child from the collection. I am using RC3 and have tried using a few different cache implementations (ObjectCachePerBrokerImpl, ObjectCacheDefaultImpl, ObjectCacheEmptyImpl) but always get the same result. What am I missing? - 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: 1:m relation not updating
Sam I was having the same problem that you were... could you possibly email me your mapping of classes to tables for the two classes. I would like to cross check that at least my mapping configuration is similar to yours thanks James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 6/10/2003 9:02:07 PM >>> Hi there, Here is the situation.. Say I have class A and class B 1->m I created the repository.xml Everything works fine when storing A to DB with a couple of B's Tx.lock(a, Transaction.WRITE); Tx.Commit Next step is to load a and add more B's and then save it again. I created the query. And all a and the related B's get loaded ok Now I add a couple more B's And store a Tx.lock(a, Transaction.WRITE); Also tried Tx.lock(a, Transaction.UPGRADE); But the new B's don't get inserted in DB. Any ideas Thanks Sam - 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: 1:m relation not updating
Thomas, I am experiencing the same problem but i am not using to ODMG api (as i think Saman was) but rather straight PersistenceBroker. 1. Should i change my Vector collections to use DList ? or how do you mean 'using DList' as your collection ? 2. WHen doing a proper 1-M mapping.. do i have to construct new children, point them back to their parent object (the ) and then add it to the collection then call store() on the parent ? thanks.. I had previously posted the same qn titled "1-M mappings" but i never got a response from anyone thanks again James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 6/11/2003 1:51:21 AM >>> You have to lock the b elements too if you are using normal collections to hold the many-side of the association. If you were using DList as your collection class this won't be required. cheers, thomas Saman Ghodsian wrote: > Hi there, > > Here is the situation.. Say I have class A and class B 1->m > > I created the repository.xml > > Everything works fine when storing A to DB with a couple of B's > > Tx.lock(a, Transaction.WRITE); > Tx.Commit > > > Next step is to load a and add more B's and then save it again. > > I created the query. And all a and the related B's get loaded ok > > Now I add a couple more B's > And store a > > > Tx.lock(a, Transaction.WRITE); > Also tried > Tx.lock(a, Transaction.UPGRADE); > > But the new B's don't get inserted in DB. > Any ideas > > Thanks > > > > Sam > > > - > 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]
Re: 1-M mappings retry
Hi I just wanted to reping the group on this questions I am having trouble performing tasks with a 1-M mapping None of my objects use the reference descritor constructs. I constructed my 1-M exactly as the documentation suggests but the problem that i have is that when my test attempts to add a new child object (adjustmentTO) to the order (orderTO) it does not work. i basically read the orderTO from the database, add a new AdjustmentTO object to the adjustments collection and try to store. It does not store the adjustment despite having auto-update set to true. However, if i call store on both the order and the adjustment, then the order is updated and the adjustment is created. is this how it is supposed to function or am i missing something ? thanks J James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 5/31/2003 3:23:19 PM >>> Hi Is the reference-descriptor in a 1-M mapping requried for a proper 1-M mapping ? I have an OrderTO object that can hold a collection of AdjustmentTO objects here is my descriptor mapping (notice, no reference mapping in the child class) descriptor start--- descriptor end--- AdjustmentTO objects are only written to the database when the Collection actually contains any AdjustmentTO objects the first time i create the order. All subsequent attempts to add one more AdjustmentTO object to the vector and store is not working. When i re-read the OrderTO object i simply get back the same objects that were created the first time - no more no less. is this a mapping problem ? Why is that reference descriptor required ? thanks James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com - 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: 1-M mappings
Hi Is the reference-descriptor in a 1-M mapping requried for a proper 1-M mapping ? I have an OrderTO object that can hold a collection of AdjustmentTO objects here is my descriptor mapping (notice, no reference mapping in the child class) descriptor start--- descriptor end--- AdjustmentTO objects are only written to the database when the Collection actually contains any AdjustmentTO objects the first time i create the order. All subsequent attempts to add one more AdjustmentTO object to the vector and store is not working. When i re-read the OrderTO object i simply get back the same objects that were created the first time - no more no less. is this a mapping problem ? Why is that reference descriptor required ? thanks James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sequence auto-increment for long
Hi i came across this in the RC3 release notes : - adapt sequence manager implementations using 'long' instead 'int' keys Does this mean that the sequence managers that go against the database to grab a bunch of sequences can now do so for Long and Integer types ? ie.. so that my PKs in Java can now be of type Long.class ? i was really worried that my application would at some point run out of sequences because it is 'insert-heavy' (lots of little data is written to some of my tables) if this is so.. that would be spectacular. James James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Handle broken database connections
Armin what happens when you set the connection pool to test connections using these flags ? If it finds dead connections 1. Does it drop them and reconnect them or just drop them ? 2. If it just drops them, what happens when the broker goes to borrow from the pool and finds nothing in there. Since the setting for "whenExhaustedAction" is set to GROW, will it at least create a connection thereby avoiding Reinhard's problem altogether ? just a thought. James Nyika Cambridge Technology Partners The global eServices company of Novell, Inc. http://www.novell.com >>> [EMAIL PROTECTED] 5/29/2003 8:41:24 AM >>> Hi Armin, yes I think so. A 'refresh()' would make sense. Because there are a lot of situations where the connection to the database can be lost. And when I look in archive for similar situations, there are some of them. I saw, there is just a 'connection.isClosed()' in ConnectionFactoryConPooledImpl.validateObject() and a lost connection is already open. And additionaly the connection will be checked only if a broker will be borrowed. What do you think about my actual workaround? public void checkConnection() throws MyConnectionFailException { try { // try a fast testquery like 'select 1 from dual' in oracle Object obj = broker.getObjectByQuery(query); } catch (Exception ex) { try { PersistenceBrokerFactory.releaseAllInstances(); broker = PersistenceBrokerFactory.createPersistenceBroker(...); } catch (Exception ex) { throw new MyConnectionFailException(); } } } Thanks in advance, Reinhard -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 28, 2003 3:13 PM To: OJB Users List Subject: Re: Handle broken database connections Hi Reinhard, - Original Message - From: "Reinhard Dunst" <[EMAIL PROTECTED]> To: "OJB-Users-List (E-mail)" <[EMAIL PROTECTED]> Sent: Wednesday, May 28, 2003 1:13 PM Subject: Handle broken database connections > Hi, > > how can I handle broken database connections. If I shut down the database > and restart it, you could use the 'validationQuery' attribute within the connection-pool element to check connection before it could be obtained from pool. currently we don't have a 'refresh()' method on ConnectionFactory level to allow the implementation class to refresh their connection pool - if con-pooling was supported. Would such a 'refresh' method make sense? regards, Armin > I get following errormessage occure: > > [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: > PersistenceBrokerException during > the execution of the query: > Io exception: Connection reset by peer: socket write error Io exception: > Connection reset by peer: socket write error > java.sql.SQLException: Io exception: Connection reset by peer: socket write > error > > My current configuration is > java 1.4.1 > ojb 1.0 rc2 > > Thanks in advance > Reinhard > > > > > == > Reinhard Dunst > T.U.B. Technologie- & Unternehmensberatung GmbH > > mobile: +43.664 - 2525928 > email: mailto:[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]