auto-delete setting in 1:n relationships
Hello, when setting auto-delete="link" in 1:n relationships the documentation states that this behaves like "none". What are the reason for not unlinking the referenced objects? Take the Article ProductGroup example. Why does auto-delete = "link" for ProductGroup does not set productGroupId to null in referenced Articles when deleting a ProductGroup? Do I correctly understand the FAQ entry 3.1 (difference between PB and ODMG) that the ODMG layer would unlink theses references? (Do I have to switch from RemovalAware to DListImpl to have this behaviour?) Thanks a lot, Vincenz
Oracle Null value for prepared select statement
Hi, I am using an OQLQuery with a parameter that is nullable. e.g. "Select all from class1 where field2 = $1 and field3 = ?2" The underlying JDBCImpl uses a PreparedStatement and sets this parameter to null (with setNull(..). e.g "select column1, column2, column3 from table1 where column2 = ? and column3 = ?" ps.setNull(2, Types.NUMERIC); Under oracle the result set is always empty. I tried to change the OQLQery to use field3 = NIL with no success. Is there any way to get the correct result set when binding null values and Using Oracle 9i? Thanks, Vincenz
Oracle Null value for prepared select statement
Hi, I am using an OQLQuery with a parameter that is nullable. e.g. "Select all from class1 where field2 = $1 and field3 = ?2" The underlying JDBCImpl uses a PreparedStatement and sets this parameter to null (with setNull(..). e.g "select column1, column2, column3 from table1 where column2 = ? and column3 = ?" ps.setNull(2, Types.NUMERIC); Under oracle the result set is always empty. I tried to change the OQLQery to use field3 = NIL with no success. Is there any way to get the correct result set when binding null values and Using Oracle 9i? Thanks, Vincenz
need better understanding of adding and removing to 1:n collections
Hello, I have a simple 1:n relationship similar to the one in the documentation (both have auto-incremented primary keys). I use the ODMG layer. With the default settings only removals are tracked (because af the RemovalAware collection). Changing auto-update to true leaves me with problems when inserting new objects. Updating (adding and removing) is then fine. But with ODMG I can not use this setting. Next I tried to use the Dlist as the collection class. Here adding works but removals are not tracked. I ended up with writing my own RemovalAndAddingAwareManagableCollection. Is this really necessary and why? Thanks, Vincenz Braun - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem with anonymous keys in 1:n back-mapping (again)
This is not exactly my problem. I construct my Transition object myself. Like this: Transition t = new Transition(); t.setPostStatus(postStatus); t.setAction(action); t.setPreStatus(preStatus); Now I use the broker to get a ClassDescriptor for Transitions. I iterate over the primary keys (unfortunately one can not define other unique keys...) and want to read the field values to construct an Identity to be used with broker.getObjectWithIdentity. The anonymous field values of self-constructed object are null. Transition objects created (materialized) by the broker might show the correct field value. But this is not the point. I added the fields to the class and do not use the anonymous access anymore. In t.setPostStatus(status) etc. i synchronize the respective field values: postStatusName = postStatus == null? null: postStatus.getName(); I expected the AnonymousPersistentField to return postStatus == null? nul:postStatus.getName() for the anonymous field postStatusName regardless whether this object was created by ty ojb or myself. As I understand all fields can be made anonymous. But for referenced PK's it would make sense to introduce a AnonymousForeignKeyPersistentField? Thanks, Vincenz > -Original Message- > From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 15, 2003 4:45 PM > To: OJB Users List > Subject: Re: Problem with anonymous keys in 1:n back-mapping (again) > > > hi vincenz, > > the main difference is that you use anonymous primary-keys but this > should not cause troubles. imo you'll have to materialize > transition to > get the fields filled. > > see RowReaderDefaultImpl#buildWithReflection (i set a breakpoint in > AnonymousPersistentField#set to find out) > > hth > jakob > > Vincenz Braun wrote: > > > hi jakob, > > > > my problem might be a little bit different. I have tables > Actions and > > Statutes with a string primary key. Table Transitions has three > > columns preStatusName, > > actionName, postStatusName. > > preStatusName and postStatusName reference to primary key > of Statuses and > > actionName > > references to primary key of Actions. > > > > Table Transitions has a compound primary key (preStatusName, > > actionName, postStatusName). > > > > > > > primaryKey="true" access="anonymous"/> > > > primaryKey="true" access="anonymous"/> > > > primaryKey="true" access="anonymous"/> > > > > > > > > > > > > > > > > > > > > > > > > I use the PB Api only to get meta information of a class > (PrimaryKeys > > etc.) to build up a query for that class depending on the values of > > the primary key (e.g. to look up the class). > > When I use field.get(transition) I get null for the > anonymous fields. When I > > remove > > the access type anonymous everything is fine. The > transition object might > > not be constructed > > by the PB e.g. > > > > I have > > Transition t = new Transition(); > > t.setPostStatus(postStatus); > > t.setAction(action); > > t.setPreStatus(preStatus); > > > > persistentField.get(t) returns null where persistentField is one of > > the three declared fields with anonymous access. Is postStatusName > > anonymously mapped to postStatus.name? Or has the > > transition object to be materialized from the PB to return > the correct field > > values? > > > > Thank you very much, > > Vincenz > > > > > >>-Original Message- > >>From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] > >>Sent: Monday, October 13, 2003 8:42 PM > >>To: OJB Users List > >>Subject: Re: Problem with anonymous keys in 1:n back-mapping (again) > >> > >> > >>hi vincent, > >> > >>just to make it clear the attribute 'userId' is null because > >>access is > >>anonymous and no attribute is required in your class. the attribute > >>'user' should contain an instance of object User. > >> > >>i do have a testcase for this feature and it works. > >> > >> >> class="brj.ojb.Person" > >> table="tabPerson" > >>> > >>>> name="id" > >> column="id" > >> jdbc-type="INTEGER" > >> primarykey="true" > >> autoincrement="t
RE: Problem with anonymous keys in 1:n back-mapping (again)
hi jakob, my problem might be a little bit different. I have tables Actions and Statutes with a string primary key. Table Transitions has three columns preStatusName, actionName, postStatusName. preStatusName and postStatusName reference to primary key of Statuses and actionName references to primary key of Actions. Table Transitions has a compound primary key (preStatusName, actionName, postStatusName). I use the PB Api only to get meta information of a class (PrimaryKeys etc.) to build up a query for that class depending on the values of the primary key (e.g. to look up the class). When I use field.get(transition) I get null for the anonymous fields. When I remove the access type anonymous everything is fine. The transition object might not be constructed by the PB e.g. I have Transition t = new Transition(); t.setPostStatus(postStatus); t.setAction(action); t.setPreStatus(preStatus); persistentField.get(t) returns null where persistentField is one of the three declared fields with anonymous access. Is postStatusName anonymously mapped to postStatus.name? Or has the transition object to be materialized from the PB to return the correct field values? Thank you very much, Vincenz > -Original Message- > From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] > Sent: Monday, October 13, 2003 8:42 PM > To: OJB Users List > Subject: Re: Problem with anonymous keys in 1:n back-mapping (again) > > > hi vincent, > > just to make it clear the attribute 'userId' is null because > access is > anonymous and no attribute is required in your class. the attribute > 'user' should contain an instance of object User. > > i do have a testcase for this feature and it works. > > class="brj.ojb.Person" >table="tabPerson" > > > name="id" > column="id" > jdbc-type="INTEGER" > primarykey="true" > autoincrement="true" > conversion="brj.ojb.TestFieldConversion" >/> > ... > > name="konti" > > collection-class="org.apache.ojb.broker.util.collections.Manag > eableArrayList" >orderby="saldo" >sort="ASC" > element-class-ref="brj.ojb.Konto" > proxy="true" >refresh="true" > auto-retrieve="true" > auto-update="true" > auto-delete="true" >> > > > > > class="brj.ojb.Konto" >table="tabKonto" > > > name="idKto" > column="id" > jdbc-type="INTEGER" > primarykey="true" >autoincrement="true" >/> > name="idPerson" > column="idPerson" > jdbc-type="INTEGER" > access="anonymous" >/> > ... > name="inhaber" > class-ref="brj.ojb.Person" >> > > > > > > hth > jakob > > > Vincenz Braun wrote: > > > Hello, > > > > I have the same problem described earlier in this list by Gerhard > > Grosse. What is the status of this issue? Is someone > working on this > > or has at least committed a bug report? I queried scarab > and did not > > find a matching issue, yet. > > > > Any help greatly appreciated. > > Vincenz > > > > > > original post from Gerhard Grosse: > > > > tried to implement a bi-directional 1:n association > between classes > > User > > and UserRole with an anonymous key in UserRole: > > > > > class="de.lexcom.noralinkojb.model.User" > > table="OJB.USERS"> > > > > > name="id" > > column="ID" > > jdbc-type="INTEGER" > > primarykey="true" > > autoincrement="true"/> > > > > > name="roles" > > > element-class-ref="de.lexcom.noralinkojb.model.UserRole" > > auto-retrieve="true" > > auto-update="true" > > auto-delete="true"> > >
Problem with anonymous keys in 1:n back-mapping (again)
Hello, I have the same problem described earlier in this list by Gerhard Grosse. What is the status of this issue? Is someone working on this or has at least committed a bug report? I queried scarab and did not find a matching issue, yet. Any help greatly appreciated. Vincenz original post from Gerhard Grosse: tried to implement a bi-directional 1:n association between classes User and UserRole with an anonymous key in UserRole: When I now load a User object which has associated UserRoles, the user attribute of all UserRoles is null. The problem disappears when I make userId a normal attribute of UserRole. Is this a known limitation of anonymous keys, is it a bug or am I doing something wrong here? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with anonymous keys in 1:n back-mapping (again)
Hello, I have the same problem described earlier in this list by Gerhard Grosse. What is the status of this issue? Is someone working on this or has at least committed a bug report? I queried scarab and did not find a matching issue, yet. Any help greatly appreciated. Vincenz original post from Gerhard Grosse: tried to implement a bi-directional 1:n association between classes User and UserRole with an anonymous key in UserRole: When I now load a User object which has associated UserRoles, the user attribute of all UserRoles is null. The problem disappears when I make userId a normal attribute of UserRole. Is this a known limitation of anonymous keys, is it a bug or am I doing something wrong here? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
temporary fix for null foreign key references
Hello everybody, does anybody has a workaraound or temporary patch for the null foreign key reference bug in OJB? This bug was reported twice in scarab. It occurs when inserting or updating objects that have a null foreign key reference. When using primitives (integer etc. ) as a primary key for the referenced entity OJB tries to set the reference to an object with 0 as the primary key. This is not intended and may result in underlying "parent key not found" exceptions when there is no entity with primay key 0. Can someone point me the right place in the source where I can temporarily make some changes to get this to work? Thanks a lot, Vincenz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Multiple unique keys per table
Does anyone have experience with multiple unique keys per table in ojb and would like to share? Consider the following scenario. I have Table A with two unique keys: 1. one one-column primary key (autoincremented) 2. one 3 column unique key (2 references) Objects of ClassA are made persistent to this table. When I store Objetcs that reference Objects of type ClassA I do not want OJB to store these objects when there is already one with the same unique key. This should be fully transparent. No exception, no manual lookup of the refence. Is that possibly? Unfortunately I only found a RowReader. And PersistenceBrokerAware only allows to throw Exceptions. I would like to have a solution set performs a lookup and if an objetcs with the same unique key is found the object will not be stored and gets the primary key set. Is such a solution possible? And what is with the cache. There are now two instances representing the same entity. Do I have to clearh the cache? Thanks in advance, Vincenz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Multiple unique keys per table
Does anyone have experience with multiple unique keys per table in ojb and would like to share? Consider the following scenario. I have Table A with two unique keys: 1. one one-column primary key (autoincremented) 2. one 3 column unique key (2 references) Objects of ClassA are made persistent to this table. When I store Objetcs that reference Objects of type ClassA I do not want OJB to store these objects when there is already one with the same unique key. This should be fully transparent. No exception, no manual lookup of the refence. Is that possibly? Unfortunately I only found a RowReader. And PersistenceBrokerAware only allows to throw Exceptions. I would like to have a solution set performs a lookup and if an objetcs with the same unique key is found the object will not be stored and gets the primary key set. Is such a solution possible? And what is with the cache. There are now two instances representing the same entity. Do I have to clearh the cache? Thanks in advance, Vincenz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
misleading documentation regarding auto settings in refence and collection descriptors
Hello, the advanced o/r tutorial says: These default settings are mandatory for proper operation of the ODMG and JDO implementation. In the following code sample, a reference-descriptor and a collection-descriptor are configured to use cascading retrieve (auto-retrieve="true" ), insert and update (auto-update="true" ) and delete (auto-delete="true" ) operations In the repository.xml documentation one can read: The auto-update attribute specifies whether OJB automatically stores this reference attribute on storing the persistent object. This attribute must be set to false if using the OTM, ODMG or JDO layer. The auto-delete attribute specifies whether OJB automatically deletes this reference attribute on deleting the persistent object. This attribute must be set to false if using the OTM, ODMG or JDO layer. So what is the right setting? Thanks in advance, Vincenz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ejb deployment: reasons for binding the factories?
Hello, I wonder why the PBFactory or ODMG Implementation is bound to a Context. For OMDG this would make sense to me if there were a TransformFactory like interface for getting the implementation class (so one can transparently use another implementation). What are the reasons why not simply use the factory calls as outside of an ejb container. The only reason i can consider of is the security constraint in dynamically loading classes. Is that right? Or do i miss a thing? Some remarks in the documentation why this is needed would help a lot (at least me). Thanks, Vincenz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Non-Decomposed collections, without implicit locking
I want to know if I have the same problem: I have a User and a Role class. User has a roles:Collection property. The repository defines the collection-descriptor with all auto- values set to true and a indirection-table UserRoles with userId and roleId has a compound primary key. I am using the ODMG API. If a write-lock an user object and add a role object to the (empty) collection the changes to that mapping are not made persistent. Strange thing: If I change another attribute of the user (email etc.) so that the objects is marked dirty the mapping is correctly made persistent. But I have no UserRole Object mapped to the indirection table (and think i do not need this) so I can not make the mapping persistent another way. Is this the same kind of problem you have? Vincenz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Newbie questions (oracle and ojb setup) (posted because archive unbrowsable)
Hi, my first steps with ojb. Some questions have arised. I post these because it is currently not possible to browse the archive under http://archives.apache.org/eyebrowse/[EMAIL PROTECTED] org. All message bodies are empty :-( I want to use ojb with a sample oracle schema. I wonder where to specify the complete url. Has anybody a working example of the repository_database.xml with oracle. Second I always get this Exception when trying to setup OJB. [org.apache.ojb.broker.metadata.ConnectionRepository] INFO: Could not found org.apache.ojb.broker.metadata.JdbcConnectionDescriptor for PBKey org.apache.ojb.broker.PBKey: repository=repository.xml, user=null, password=null java.lang.reflect.InvocationTargetException: java.lang.NullPointerException at org.apache.ojb.broker.platforms.PlatformFactory.getPlatformFor(Unknown Source) [...] Code Snippet: Implementation odmg = OJB.getInstance(); Database db = odmg.newDatabase(); //open database try { db.open( "repository.xml", Database.OPEN_READ_WRITE); } catch (ODMGException ex) { ex.printStackTrace(); } Third can anyone tell me where to report the problem with the archive? What is the problem? Thanks in advance, Vincenz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]