Re: Optimizing object materialization for 1:N relations
Hi Armin, thanks for your reply. Do you think it would be worth a try to materialize our objects with pure SQL - but after initializing them to work with them with OJB? Thanks for your opinion. Regards Tino Armin Waibel schrieb: Hi Tino, Tino Schöllhorn wrote: Hi, we are using OJB-1.0.1 and evertything works fine. Now I have the following situation: We have a security-mechanism which uses the classes ACL (AccessControlList) and ACLEntry. One ACL has many ACLEntries. Now when using the standard OJB-Materialization methods OJB uses 2 SQLs to materialize on ACL. One for the ACL and one for the ACLEntry. Because we have MANY of those ACLs I am curious if it is possible to overwrite the materialization-method so that just one SQL is used. I thought about using Prefeteched Relationships but I noticed that there are also 2 SQLs. The Prefeteched Relationships is useful if you search for more than one ACL, then OJB is able to reduce the queries to read the ACLEntries: http://db.apache.org/ojb/docu/guides/query.html#prefetched+relationships The upcoming version 1.0.5 use Prefeteched Relationships for all 1:n relations. Any ideas or even example how I could achieve that? Sorry no. regards, Armin Kind regards Tino - 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: Optimizing object materialization for 1:N relations
Hi, so I will try that. Thanks for your reply. With regards Tino Danilo Tommasina schrieb: Hi Tino, I think he meant, that you can load several ACLs with one query and use prefetched relationships for loading all depending ACLEntries for each loaded ACL. Also in this case you will have only 2 Queries, but you will bulk load several ACLs Bye danilo Tino Schöllhorn wrote: Hi Armin, thanks for your reply. Do you think it would be worth a try to materialize our objects with pure SQL - but after initializing them to work with them with OJB? Thanks for your opinion. Regards Tino Armin Waibel schrieb: Hi Tino, Tino Schöllhorn wrote: Hi, we are using OJB-1.0.1 and evertything works fine. Now I have the following situation: We have a security-mechanism which uses the classes ACL (AccessControlList) and ACLEntry. One ACL has many ACLEntries. Now when using the standard OJB-Materialization methods OJB uses 2 SQLs to materialize on ACL. One for the ACL and one for the ACLEntry. Because we have MANY of those ACLs I am curious if it is possible to overwrite the materialization-method so that just one SQL is used. I thought about using Prefeteched Relationships but I noticed that there are also 2 SQLs. The Prefeteched Relationships is useful if you search for more than one ACL, then OJB is able to reduce the queries to read the ACLEntries: http://db.apache.org/ojb/docu/guides/query.html#prefetched+relationships The upcoming version 1.0.5 use Prefeteched Relationships for all 1:n relations. Any ideas or even example how I could achieve that? Sorry no. regards, Armin Kind regards Tino - 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]
Optimizing object materialization for 1:N relations
Hi, we are using OJB-1.0.1 and evertything works fine. Now I have the following situation: We have a security-mechanism which uses the classes ACL (AccessControlList) and ACLEntry. One ACL has many ACLEntries. Now when using the standard OJB-Materialization methods OJB uses 2 SQLs to materialize on ACL. One for the ACL and one for the ACLEntry. Because we have MANY of those ACLs I am curious if it is possible to overwrite the materialization-method so that just one SQL is used. I thought about using Prefeteched Relationships but I noticed that there are also 2 SQLs. Any ideas or even example how I could achieve that? Kind regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Nested Objects Cocoon Form Binding
Hi, this is not really an issue concerning OJB. You should try to use JavaBeans accessors/mutators to achieve your goal. Look at the spring-framework for example - they have a mapping from forms to javabeans. Tino 許議中 wrote: Hi! Below is running in OJB 1.0.4 Cocoon 2.1.0 I've a set of tables with three layers. First Layer: The main table. with a primary key. Second Layer: The sub table, with a primary key, and a forean key refer to main table. it's one to many. Tress Layer: many tables with different type, type01, type02..., they've one primary key, and a forean key to the sub table. it's one to one. I want to access the all tables in one form, how to do it in repositiory.xml and the main table java bean? use Nest Objects? how? Best Regards johnson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Own Proxy-Implementation
Hi, I want to change the used Proxy-Implementation of some of my collections. So I have written a MyProxyListImpl class which implements the CollectionProxy interface: class MyProxyListImpl extends ArrayList implements CollectionProxy { // the 2 constructors. } Then I changed the collection-class-property of those collections which should use this new proxy-class and set proxy=true. But as far as I can see this new proxy-implementation is not used. How can I achieve that without changing the default Proxy-Implementation? We are using OJB 1.0.1. With regards Tino P.S: Is there a release in sight? If not - is the trunk considered stable? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Performance PB
Hi, I think you can exactly do that. Just use a thread variable (see ThreadLocal) and store a PB in that. We are doing exactly that and it works great. You just have to close the PBs when the work of your thread is done, of course. Tino Ernst Temp wrote: Hello, I am developing an application that contains of two programs One that needs persistency. Here I use PersistenceBroker very successfully The second one does not need persistency at all, and performance is quite important. The program also relies heavily on cached data, but there is no need to synchronize the program with the database or with other threads. One can assume that the database does not change at all during the runtime of the program. And here comes my problem - I also used PersistenceBroker in this program in order to reuse code. Now, I found out through profiling, that the program spends about 40 % of its time in PersistenceBroker, mostly defaultBroker() and close(). I am accessing the DB heavily (reads only), and for every read I open a PB, read the needed data (that should come ot of the cache most of the time), then close the PB. This is quite expensive. As a solution, I could use only one PB for each thread open it at the start, leave it open, and then I would not need any opening and closing at all (except the first one for each thread). My questions are - can I do that and if so, is it wise? - are there other - better solutions? May be done through configuration of the properties files? Thank you very much for your help and kind regards, Ernst NB - I am using OJB v 1.0.0. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can't read repository file 'repository.xml
Hi, read: http://db.apache.org/ojb/docu/guides/ojb-properties.html. Have a look at the examples. You don't explicitly load the repository.xml file. Tino Sergio del Amo Caballero wrote: Hi all, I am getting an error while trying to retrieve my repository.xml file. My repository.xml is under the WEB-INF/classes directory of my struts web application. Exactly the line is where i try to read it is: PBKey pbKey = new PBKey(repository.xml); I tried with relative url-path: PBKey pbKey = new PBKey(/WEB-INF/classes/repository.xml); and local disk path: PBKey pbKey = new PBKey(/home/user/web_app/WEB-INF/classes/repository.xml); but without success. Nothing comes in catalina.out and i do not have any idea where can be the problem. If anyone can point me to a solution, it would be great. Here is the error: HTTP Status 500 - *type* Exception report *message* *description* _The server encountered an internal error () that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Can't read repository file 'repository.xml' org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *root cause* org.apache.ojb.broker.metadata.MetadataException: Can't read repository file 'repository.xml' org.apache.ojb.broker.metadata.MetadataManager.init(Unknown Source) org.apache.ojb.broker.metadata.MetadataManager.init(Unknown Source) org.apache.ojb.broker.metadata.MetadataManager.getInstance(Unknown Source) org.apache.ojb.broker.query.QueryFactory.getRepository(Unknown Source) org.apache.ojb.broker.query.QueryFactory.newQuery(Unknown Source) org.apache.ojb.broker.query.QueryFactory.newQuery(Unknown Source) com.softamo.libamo.about.dao.AboutDAO.findAllAbout(AboutDAO.java:209) com.softamo.libamo.struts.about.AboutPageAction.execute(AboutPageAction.java:30) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) *note* _The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs._ Apache Tomcat/5.5.17 thanks in advanced for your feeback, Sergio del Amo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Finding Broker/Connection leak
Dear Armin, thanks for your reply. I will try to integrate the finalize()-code in our PB. Is there somewhere a document of the history of changes of OJB 1.0.1 to the current released version? I'm asking because we are thinking of moving to the current version and I want to estimate the impact to our system. With regards Tino Armin Waibel wrote: Hi Tino, Tino Schöllhorn wrote: Hi, I have a situation where we are running out of PersistenceBrokers (using 1.0.1). We have a web application which so far runs fine - but somehow some requests are causing the application not to close its PB. We can see this when we are monitoring the used connections of mysql which are slowly growing - even if we are using ConnectionPooling. These connection are on the state SLEEP for quite a long time and seem never to be closed. At some point the application runs out of PB (we are using size 100 of the PB-Pool). So it seems (quite obviously) that some PBs are not cleanly handled. Do you have any advice for us finding those leaks? In current versions there is no PB leak detection. Such a feature will be part of the next version (or try latest from SVN OJB_1_0_RELEASE branch). It would be possible to modify your 1.0.1 version to support broker leak detection. Have a look in latest PBImpl (OJB_1_0_RELEASE branch) and port the detection part in method PBimpl#setClosed and PBImpl#finalize to your class. http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java?revision=398752view=markup Does it do any good when we tune mysql that it discards connections which are quite old (via property max_timeout)? Is OJB discaring those PBs whose connections have died ? If you correctly use the PB instances (lookup PB instance when needed, close it after use) the connection pool should handle connections in a correct way. But if you don't close PB instances after a query, the connection will still be associated with the PB instance, please see http://www.mail-archive.com/ojb-user%40db.apache.org/msg15389.html regards, Armin I am glad for any suggestions. Tino - 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]
Finding Broker/Connection leak
Hi, I have a situation where we are running out of PersistenceBrokers (using 1.0.1). We have a web application which so far runs fine - but somehow some requests are causing the application not to close its PB. We can see this when we are monitoring the used connections of mysql which are slowly growing - even if we are using ConnectionPooling. These connection are on the state SLEEP for quite a long time and seem never to be closed. At some point the application runs out of PB (we are using size 100 of the PB-Pool). So it seems (quite obviously) that some PBs are not cleanly handled. Do you have any advice for us finding those leaks? Does it do any good when we tune mysql that it discards connections which are quite old (via property max_timeout)? Is OJB discaring those PBs whose connections have died ? I am glad for any suggestions. Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Finding Broker/Connection leak
An additional question: How could I monitor the PB-Pool and the Connection-Pools of OJB? Tino Tino Schöllhorn wrote: Hi, I have a situation where we are running out of PersistenceBrokers (using 1.0.1). We have a web application which so far runs fine - but somehow some requests are causing the application not to close its PB. We can see this when we are monitoring the used connections of mysql which are slowly growing - even if we are using ConnectionPooling. These connection are on the state SLEEP for quite a long time and seem never to be closed. At some point the application runs out of PB (we are using size 100 of the PB-Pool). So it seems (quite obviously) that some PBs are not cleanly handled. Do you have any advice for us finding those leaks? Does it do any good when we tune mysql that it discards connections which are quite old (via property max_timeout)? Is OJB discaring those PBs whose connections have died ? I am glad for any suggestions. Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OJB, MySQL and Query Cache
Hi, probable this isn't the correct forum - but nevertheless I hope that some can help me out. We are using OJB 1.0.1 (we're waiting for a new release to change to) and MySQL 5.0.18. Everything is working fine and OJB works like a charm. Now our sites are getting more traffic and we wanted to optimize MySQL. We noticed that MySQL is not using the Query Cache for request of OJB at all - although it is configured properly. Are there any issues known that affect the query cache of MySQL and OJB? Does anyone know where a *good* source for information for this issue is? The documentation of MySQL isn't very verbose about that. Hope someone can give me a hint. Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB, MySQL and Query Cache
Hi, I solved it, so no need to answer ;-) Be aware when changing the mysql-connector to the 3.1.x line. This driver changes the standard behaviour of the server side cached statements. This in turn disables the query cache. If you change to this connector and want to use the query cache use this flag in the connection string to disable server side prepared statements: jdbc:mysql://useServerPrepStmts=false; Tino Tino Schöllhorn wrote: Hi, probable this isn't the correct forum - but nevertheless I hope that some can help me out. We are using OJB 1.0.1 (we're waiting for a new release to change to) and MySQL 5.0.18. Everything is working fine and OJB works like a charm. Now our sites are getting more traffic and we wanted to optimize MySQL. We noticed that MySQL is not using the Query Cache for request of OJB at all - although it is configured properly. Are there any issues known that affect the query cache of MySQL and OJB? Does anyone know where a *good* source for information for this issue is? The documentation of MySQL isn't very verbose about that. Hope someone can give me a hint. Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
hashCode for Query-Objects
Hi, I have to put OJB-Query-Objects as key in a Map. Now I wonder how I would compute the hashCode of those objects. A first idea was to use the generated SQL-Code for such a Query as the key. How would I get the SQL-Code which gets generated for a Query-Object? But any other ideas how to compute the value for the hashCode are welcome! Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to do this in OJB
Hi, I think you could do a ReportQuery where you can specify an SQL. Just look in the tutorials and the JavaDocs. Tino k jee wrote: Hi All, I need some advice on how to achieve the following with ojb. Select T1.FLD1,T1.FLD2, T2.FLD2,T2.FLD3,T3.FLD1,T3.FLD2,T3.FLD4 from table1 T1, table2 T2, Table3 T3,Table4 T4 where (T4.key1=XYZ) and(T3.somefield in (A,B)) and ( (T4.FLD3 = T1.FLD3) and (T4.FLD3 =T2.FLD3) and (T4.FLD3= T3.FLD3)). Thanks you in advance, Krupa - How low will we go? Check out Yahoo! Messenger’s low PC-to-Phone call rates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Next Release
Hi, thanks. That would be great. Tino Armin Waibel wrote: Hi Tino, Tino Schöllhorn wrote: Hi, we are currently using OJB 1.0.1 and are thinking about updating to the latest release. When do you think the next version 1.0.5 will be released? Last week I wasn't able to work on OJB. I will try to check in all changes related to version 1.0.5 this week. Tom setup a database array to run OJB's test suite against different databases. If these tests don't unveil new bugs we will start with the release vote. regards, Armin With regards Tino - 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]
Next Release
Hi, we are currently using OJB 1.0.1 and are thinking about updating to the latest release. When do you think the next version 1.0.5 will be released? With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Way to prevent store?
Hi, I have a situation where I want to prevent the creation of an object in the database. Is there a way to prevent the insertion via the callback-methods (beforeInsert) ? Throwing an Exception in these methods doesn't work, because the situation is not an error and I want to prevent the change of client code. If that is not possible should I extend the PersistenceBrokerImpl and change the PB.store(Object,Identity,ClassDescriptor, boolean, boolean) method accordingly? I am glad for any - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Setting Default Class for Collections
Hi, I want to use an own implementation of a java.util.List-Class in my project and I am trying to find the place where to change the default List implementation. I couldn't find it int the OJB.properties file. I am using OJB 1.0.1. With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
PB.store extremely slow
Hi, we are using OJB 1.0.1 and we have found a very strange issue: We have a class User and a class Group. Now we have a quite common and simple use-case that a User becomes member of a Group. The code for this is like: User user = ...; Group group = ...; user.addGroup(group); pb.beginTransaction(); pb.store(user); pb.commitTransaction(); So far so good. But now it gets weird: If one has many users the pb.store()-part takes ages. Java and the database (in my case: mysql) take a very large part of the cpu-performance. Is this a known issue with 1.0.1 so we can change ojb? Or are we doing something completely wrong? I suppose it has something to do with the auto-*-settings, but we are using those in other use-cases as well and have no problems there. The class-descriptors are defined like (fields have been ommited): class-descriptor class=kos.wnetz.om.User table=tk_user ... collection-descriptor name=groups collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=kos.wnetz.om.Group auto-retrieve=true auto-update=object auto-delete=link proxy=false indirection-table=tk_group_user fk-pointing-to-this-class column=GRUS_User/ fk-pointing-to-element-class column=GRUS_Group/ attribute attribute-name=reverseCollection attribute-value=users/ /collection-descriptor /class-descriptor class-descriptor class=kos.wnetz.om.Group table=tk_group ... collection-descriptor name=users collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=kos.wnetz.om.User auto-retrieve=true auto-update=object auto-delete=link proxy=true indirection-table=tk_group_user fk-pointing-to-this-class column=GRUS_Group/ fk-pointing-to-element-class column=GRUS_User/ attribute attribute-name=reverseCollection attribute-value=groups/ /collection-descriptor /class-descriptor I am glad for any help With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PB.store extremely slow
Hi, just one more piece of information: If I set auto-update=none on either groups or users the storing is fast. So I think there is happening a cycle because a store on a users results in a store of a group which in turn results in a store of all users in that group. I don't know if this is a bug or a feature ;-) What do you think? Tino Tino Schöllhorn wrote: Hi, we are using OJB 1.0.1 and we have found a very strange issue: We have a class User and a class Group. Now we have a quite common and simple use-case that a User becomes member of a Group. The code for this is like: User user = ...; Group group = ...; user.addGroup(group); pb.beginTransaction(); pb.store(user); pb.commitTransaction(); So far so good. But now it gets weird: If one has many users the pb.store()-part takes ages. Java and the database (in my case: mysql) take a very large part of the cpu-performance. Is this a known issue with 1.0.1 so we can change ojb? Or are we doing something completely wrong? I suppose it has something to do with the auto-*-settings, but we are using those in other use-cases as well and have no problems there. The class-descriptors are defined like (fields have been ommited): class-descriptor class=kos.wnetz.om.User table=tk_user ... collection-descriptor name=groups collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=kos.wnetz.om.Group auto-retrieve=true auto-update=object auto-delete=link proxy=false indirection-table=tk_group_user fk-pointing-to-this-class column=GRUS_User/ fk-pointing-to-element-class column=GRUS_Group/ attribute attribute-name=reverseCollection attribute-value=users/ /collection-descriptor /class-descriptor class-descriptor class=kos.wnetz.om.Group table=tk_group ... collection-descriptor name=users collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=kos.wnetz.om.User auto-retrieve=true auto-update=object auto-delete=link proxy=true indirection-table=tk_group_user fk-pointing-to-this-class column=GRUS_Group/ fk-pointing-to-element-class column=GRUS_User/ attribute attribute-name=reverseCollection attribute-value=groups/ /collection-descriptor /class-descriptor I am glad for any help With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OJB 1.0.x and Java5.0
Hi, we are currently thinking of moving from JDK1.4.2 to Java 5.0.x. The most interesting part of new Java Editition is the use of Generics which will lead to a much better understandable code-base. I have a few questions, which might be answered by someone of the OJB community: - Are there any known issues of using OJB 1.0.x with Java 5.0? - If so, will OJB 1.1 work with Java 5.0? - Does anyone use Java 5.0 in a production system? Perhaps someone already has expierience with Java 5.0 and OJB and can share this information. With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: strange OJB behaviour
Hi, would you post your loop-code, so it is possible to see what changes you are doing? Tino T. K. Chris wrote: HI, I have tried to access a database through a loop. while the loop is running, I manually modify (in live) and commit a record in the data base. The modification is not detected, at the next incrementation within the running loop. What could be the problem. It sounds as I am missing something... Your help is precious; Thanks. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Concurrency: Best practices
Hi, we are currently working at an web-application, which is currently single-threaded. For performance reason it is obvious that it should be multi-threaded. We are using OJB as persistence-layer. Now my question: Does anyone has best practices for creating an thread-safe object-model? Suppose we have the following class: class Person { String getName(); void setName(String aName); void addTeam(Team t); Collection getTeams(); void removeTeam(Team t); } What would be the best version of this class? What methods should be synchronized and which methods don't have to be synchronized? If someone has a hint where I could learn that, I'd really appreciate that. With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ConcurrentModificationException while Deleting Objects
Hi, I have a weird problem. We are using OJB 1.0 and are greatly satisfied. Now we stumbled across a strange problem. When deleting a Person-Object with: Person p = ...; pb.beginTransaction(); pb.delete(p); pb.commitTransaction(); we get (sometimes) the following Exception: java.util.ConcurrentModificationException java.util.AbstractList$Itr.checkForComodification(AbstractList.java: 448) java.util.AbstractList$Itr.next(AbstractList.java: 419) org.apache.ojb.broker.core.PersistenceBrokerImpl.deleteCollections(null: no source available) org.apache.ojb.broker.core.PersistenceBrokerImpl.doDelete(null: no source available) org.apache.ojb.broker.core.PersistenceBrokerImpl.delete(null: no source available) org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no source available) org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no source available) kos.generator.DataObject.delete(DataObject.java: 106) kos.wnetz.modules.editor.DAOEditorModule.deleteIt(DAOEditorModule.java: 403) sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java: no source available) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) java.lang.reflect.Method.invoke(Method.java: 324) kos.wnetz.system.Action.invoke(Action.java: 164) kos.wnetz.system.Action$1.call(Action.java: 213) EDU.oswego.cs.dl.util.concurrent.FutureResult$1.run(null: no source available) java.lang.Thread.run(Thread.java: 534) -- END Stacktrace The thing is: I am absolutely sure that we do not modify the object when deleting it. Do you have any idea what I can do about it? Should I switch to OJB 1.0.1? I am glad for any help. Tino P.S.: The configuration for the Person-Object is the following (it is quite long, sorry about that ;-)): class-descriptor class=kos.intranet2.om.Person table=Person field-descriptor name=id column=PE_ID jdbc-type=INTEGER primarykey=true autoincrement=true access=readonly/ field-descriptor name=userId column=PE_User jdbc-type=INTEGER/ field-descriptor name=title column=PE_Title jdbc-type=VARCHAR/ field-descriptor name=firstname column=PE_Firstname jdbc-type=VARCHAR/ field-descriptor name=lastname column=PE_Lastname jdbc-type=VARCHAR/ field-descriptor name=fullName column=PE_FullName jdbc-type=VARCHAR/ field-descriptor name=initials column=PE_Initials jdbc-type=VARCHAR/ field-descriptor name=description column=PE_Description jdbc-type=LONGVARCHAR/ field-descriptor name=gender column=PE_Gender jdbc-type=BIT/ field-descriptor name=birthday column=PE_Birthday jdbc-type=DATE/ field-descriptor name=country column=PE_Country jdbc-type=VARCHAR/ field-descriptor name=pictureId column=PE_Picture jdbc-type=INTEGER/ field-descriptor name=typeId column=PE_Type jdbc-type=INTEGER access=anonymous/ field-descriptor name=privateData column=PE_Private jdbc-type=BIT/ field-descriptor name=owner column=PE_Owner jdbc-type=INTEGER/ field-descriptor name=creationDate column=PE_CreationDate jdbc-type=TIMESTAMP/ field-descriptor name=archiveDate column=PE_ArchiveDate jdbc-type=TIMESTAMP/ !-- 1: N - Relation: 1er Seite Type -- reference-descriptor name=type class-ref=kos.intranet2.om.PersonType auto-retrieve=true auto-update=link auto-delete=none foreignkey field-ref=typeId/ attribute attribute-name=reverseCollection attribute-value=persons/ /reference-descriptor !-- M:N - Relation Person-Addresses -- collection-descriptor name=addresses collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=kos.intranet2.om.Address auto-retrieve=true auto-update=link auto-delete=link proxy=true indirection-table=Person_Address fk-pointing-to-this-class column=PEAD_Person/ fk-pointing-to-element-class column=PEAD_Address/ attribute attribute-name=reverseCollection attribute-value=persons/ /collection-descriptor !-- Company-Persons-- collection-descriptor name=companyPersons collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=kos.intranet2.om.CompanyPerson auto-retrieve=true auto-update=object auto-delete=object proxy=true inverse-foreignkey field-ref=personId/ attribute attribute-name=reverseReference attribute-value=person/ /collection-descriptor !-- TeamPerson -- collection-descriptor name=teamPersons collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=kos.intranet2.om.TeamPerson auto-retrieve=true auto-update=object auto-delete=object proxy=true inverse-foreignkey field-ref=personId/ attribute attribute-name=reverseReference attribute-value=person/ /collection-descriptor !-- ProjectPerson -- collection-descriptor name=projectPersons
Re: [SUGGESTION] - S02 - Answering behaviour on this forum
Hi Ilias, well I not for starting any flame wars. But if you think there should be a common, better FAQ list and the existing documentation is not enough - why don't you just start a FAQ-List and try to improve this project. As you already stated: this is open source and anyone who is interested can try to contribute ;-) Tino Ilias Lazaridis wrote: Daniel Perry wrote: [moved down] From: news [mailto:[EMAIL PROTECTED] Behalf Of Ilias Lazaridis Edson Carlos Ericksson Richter wrote: [moved down] Ilias Lazaridis escreveu: I've noticed several threads, which remained unanswered. This could imply to visitors that the product OJB is death (or not yet alive) !!! !!! [...] To distinguish a project: - care about newcomers - accept their laziness/confusion, point them to the relevant resource - hopefully they remember this in future. - and act the same against new newcomers. A few answers can keep a newcomer within the project. Increased userbase. [...] I think these comments would be fair for a commercial product, [...] - (comments) My suggestions are very fair, even within the context of open source, which has become high competitive. Every involved parties (Team, Contributors, Users) should be interested to increase the user-base of OJB. Questions like Recommended ObjectCache for ODMG should be served immediately with a link, even if this question was raised several times. So, creating an FAQ, where every (even non experienced) community member can point the 'lazy' newcomers to the relevant subsection, should be a major goal. . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ConcurrentModificationException while Deleting Objects
Hi Gerhard, our application is single-threaded. With the concurrent-package we are ensuring that requests are delivered in a defined time-frame, or else they are dismissed. So I do not know which other Thread should modify the Person object. But do you know how I could get the name of the collection which cannot be iterated? Tino Gerhard Grosse wrote: Hi Tino this looks like a multi-threading problem. java.util.ConcurrentModification exception is thrown by the Java runtime when a List is being modified while an iterator is iterating over it. The list in this case is one of the collections in your Person object. Is it possible that a second thread is working on the same Person? Also the bottom of your stack trace EDU.oswego.cs.dl.util.concurrent.FutureResult$1.run(null: no source available) java.lang.Thread.run(Thread.java: 534) points into this direction. Gerhard On Fri, 19 Nov 2004 11:51:02 +0100, Tino Schöllhorn [EMAIL PROTECTED] wrote: Hi, I have a weird problem. We are using OJB 1.0 and are greatly satisfied. Now we stumbled across a strange problem. When deleting a Person-Object with: Person p = ...; pb.beginTransaction(); pb.delete(p); pb.commitTransaction(); we get (sometimes) the following Exception: java.util.ConcurrentModificationException java.util.AbstractList$Itr.checkForComodification(AbstractList.java: 448) java.util.AbstractList$Itr.next(AbstractList.java: 419) org.apache.ojb.broker.core.PersistenceBrokerImpl.deleteCollections(null: no source available) org.apache.ojb.broker.core.PersistenceBrokerImpl.doDelete(null: no source available) org.apache.ojb.broker.core.PersistenceBrokerImpl.delete(null: no source available) org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no source available) org.apache.ojb.broker.core.DelegatingPersistenceBroker.delete(null: no source available) kos.generator.DataObject.delete(DataObject.java: 106) kos.wnetz.modules.editor.DAOEditorModule.deleteIt(DAOEditorModule.java: 403) sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java: no source available) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) java.lang.reflect.Method.invoke(Method.java: 324) kos.wnetz.system.Action.invoke(Action.java: 164) kos.wnetz.system.Action$1.call(Action.java: 213) EDU.oswego.cs.dl.util.concurrent.FutureResult$1.run(null: no source available) java.lang.Thread.run(Thread.java: 534) -- END Stacktrace The thing is: I am absolutely sure that we do not modify the object when deleting it. Do you have any idea what I can do about it? Should I switch to OJB 1.0.1? I am glad for any help. Tino P.S.: The configuration for the Person-Object is the following (it is quite long, sorry about that ;-)): class-descriptor class=kos.intranet2.om.Person table=Person field-descriptor name=id column=PE_ID jdbc-type=INTEGER primarykey=true autoincrement=true access=readonly/ field-descriptor name=userId column=PE_User jdbc-type=INTEGER/ field-descriptor name=title column=PE_Title jdbc-type=VARCHAR/ field-descriptor name=firstname column=PE_Firstname jdbc-type=VARCHAR/ field-descriptor name=lastname column=PE_Lastname jdbc-type=VARCHAR/ field-descriptor name=fullName column=PE_FullName jdbc-type=VARCHAR/ field-descriptor name=initials column=PE_Initials jdbc-type=VARCHAR/ field-descriptor name=description column=PE_Description jdbc-type=LONGVARCHAR/ field-descriptor name=gender column=PE_Gender jdbc-type=BIT/ field-descriptor name=birthday column=PE_Birthday jdbc-type=DATE/ field-descriptor name=country column=PE_Country jdbc-type=VARCHAR/ field-descriptor name=pictureId column=PE_Picture jdbc-type=INTEGER/ field-descriptor name=typeId column=PE_Type jdbc-type=INTEGER access=anonymous/ field-descriptor name=privateData column=PE_Private jdbc-type=BIT/ field-descriptor name=owner column=PE_Owner jdbc-type=INTEGER/ field-descriptor name=creationDate column=PE_CreationDate jdbc-type=TIMESTAMP/ field-descriptor name=archiveDate column=PE_ArchiveDate jdbc-type=TIMESTAMP/ !-- 1: N - Relation: 1er Seite Type -- reference-descriptor name=type class-ref=kos.intranet2.om.PersonType auto-retrieve=true auto-update=link auto-delete=none foreignkey field-ref=typeId/ attribute attribute-name=reverseCollection attribute-value=persons/ /reference-descriptor !-- M:N - Relation Person-Addresses -- collection-descriptor name=addresses collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList element-class-ref=kos.intranet2.om.Address auto-retrieve=true auto-update=link auto-delete=link proxy=true indirection-table=Person_Address fk-pointing-to-this-class column=PEAD_Person/ fk-pointing-to-element-class column=PEAD_Address/ attribute attribute-name=reverseCollection attribute
Re: How to monitoring connecton pool?
Hi, I don't know how to get this information. But you could quite easily configure the connection-managers as such that they are automatically closing forgotten persistence-broker instances and their connections. Please see: http://db.apache.org/ojb/docu/guides/connection.html Rodrigo G. Tavares de Souza wrote: Hi, I had had problems with connection pool, cause there are someone broker in the application that I'm not closing, after some access the max number of connections exceed and I get an exception from Tomcat. Now I'm looking how to monitoring the activity in the pool to find where I've forgotten to close the broker. If are someone there who know how can I borrow this information from OJB, gonna be a greatest aid. :) I'm trying to get these informations: getNumActive(), getNumIdle(), getMaxIdle(), getMaxActive(), getMaxWait(). Thanks. Rodrigo - Follow the exception returned by Tomcat - java.util.NoSuchElementException at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:803) at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker(PersistenceBrokerFactoryDefaultImpl.java:99) at org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(PersistenceBrokerFactoryBaseImpl.java:158) at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(PersistenceBrokerFactory.java:65) Caused by: java.util.NoSuchElementException at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:803) at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker(PersistenceBrokerFactoryDefaultImpl.java:99) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Special Rowreader for reading hierarchies
Hi, we are using OJB 1.0 and are greatly satisfied. Now we encounter some cases where we have recursive data-structures, like: class A { Collection someAObjects; // CollectionA } So every A-Object can have several sub-object of type A. Currently we mapped this case as every other 1:N-relation in the repository_user.xml file. But this solution is relatively expansive in terms of SQL-Queries which are sent to the database. But I remember that I saw I solution on your old web-pages where a special row-reader was created for reading tree-structures. Do you have any documents or references where I can see an example of this approach? With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ConcurrentModification!!!
Hi, we are using OJB in a Tomcat-Application and are greatly satisfied. Now we are moving our application to a windows 2003 server with 2 processors and we encounter some problems. One is the following: We implemented a DownloadServlet which is responsible for delivering Streams of previously uploaded files. But on this machine we get errors when downloading some files (the thing is: sometimes it is ok, sometimes it is not). Here is the Stacktrace which I think could be responsible to this problem: java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782) at java.util.HashMap$KeyIterator.next(HashMap.java:818) at org.apache.ojb.broker.cache.InternalCache.pushToRealCache(Unknown Source) at org.apache.ojb.broker.cache.InternalCache.disableMaterializationCache(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.getObjectByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown Source) at kos.generator.DataObject.getObjectById(DataObject.java:368) at kos.wnetz.om.base.File.getFileById(File.java:156) at kos.wnetz.modules.fs2.DownloadServlet.doGet(DownloadServlet.java:34) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) Do you have any ideas how this error could be prevented? Is this a synchronization-problem of OJB? I will try to synchonize our DownloadServlet - but due to performance-reasons this is not our preferred solution (;-)) With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ConcurrentModification!!!
I forgot to mention that we are using OJB 1.0 ! Tino Schöllhorn wrote: Hi, we are using OJB in a Tomcat-Application and are greatly satisfied. Now we are moving our application to a windows 2003 server with 2 processors and we encounter some problems. One is the following: We implemented a DownloadServlet which is responsible for delivering Streams of previously uploaded files. But on this machine we get errors when downloading some files (the thing is: sometimes it is ok, sometimes it is not). Here is the Stacktrace which I think could be responsible to this problem: java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:782) at java.util.HashMap$KeyIterator.next(HashMap.java:818) at org.apache.ojb.broker.cache.InternalCache.pushToRealCache(Unknown Source) at org.apache.ojb.broker.cache.InternalCache.disableMaterializationCache(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.getObjectByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown Source) at kos.generator.DataObject.getObjectById(DataObject.java:368) at kos.wnetz.om.base.File.getFileById(File.java:156) at kos.wnetz.modules.fs2.DownloadServlet.doGet(DownloadServlet.java:34) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) Do you have any ideas how this error could be prevented? Is this a synchronization-problem of OJB? I will try to synchonize our DownloadServlet - but due to performance-reasons this is not our preferred solution (;-)) With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Debugging Queries
Hi Jakob, thanks for your answer. Will that feature be implemented in OJB 1.1? We have some queries where that feature is important for us. If this is just a matter of the MySQLPlatform-Implementation I could help outor is this a general problem? With regards Tino Jakob Braeuchi wrote: hi tino, ojb does not use the limit-clause yet. the paging is implemented by positioning the cursor in the resultset. jakob Tino Schöllhorn schrieb: Hi, I am using MySQL and OJB and now I want to create a Query over a large table. For performance reason I want to use the pageing-feature - but I have the feeling that currently OJB is somehow ommitting this (the result is fine - but the SQL seems not to include the LIMIT-clause). Is there a way to get the native SQL from a query which OJB would send to the database (this would help for other, complex queries too). With regards Tino - 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: Debugging Queries
Hi Thomas, I am perfectly aware of that - but in my opinion you're already doing the right thing: emulate the behaviour of paging when the underlying db isn't supporting it. But if the underlying db is supporting this feature (many db implement this: mysql, mssql, oracle...) it should be used because one can have dramatically network and performance increases. With regards Tino Thomas Dudziak wrote: Jakob Braeuchi wrote: hi tino, i do have an implementation using limit, but i think it's not finished yet. Please be aware that not all databases support limits in sql (e.g. McKoi). Btw, do we use paging resultsets ? In that case, we might not need limits as the driver can optimize via cursors, or not ? Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Weird behaviour of PersistenceBroker.store(Object)
Hi, several days ago I changed from RC6 to OJB 1.0.0 and so far it is running fine. But now I encounter a strange bug - something which has not happened with RC6. I have a class Team and there is a N-M-Relation between Teams and Subteam. Now I am adding some (already persistent) Teams t1...tn to another Team t: Team t = .. t.addSubTeam(t1); t.addSubTeam(t2); PersistenceBroker pb = pb.beginTransaction(); p.store(t); p.commitTransaction(); Before the update OJB inserted all necessary rows in the database. But now there only the *last* added Team persistent. The other thing is, that t1 is not in the cache either. But when I try to store Team t after each add-Statement the database and the object is correctly updated! So is this a bug or am I missing something? I suspect it is an error of OJB ?? Glad for any help. Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Weird behaviour of PersistenceBroker.store(Object)
Hello Armin, I have to admit that I simplified the description. I am sorry for that. I try now to give more information about my specific use-case. I have the following classes: class Team { protected int id; protected List subTeamTeams; public void addTeam(Team t) { TeamTeam tt = new TeamTeam(); tt.parent = this; tt.child = t; subTeamTeams.add(t); } } class TeamTeam { protected Team parent; protected Team child; protecte int position; // the reason for the association-class } The attachted xml-snippet contains the class-descriptors for these classes. I also wrote a test-case: PersistenceBroker pb = DataObjectHelper.getPBFromAlias(kos_db); Team t = Team.getTeamById(pb, 36); logger.info(Team t: + t); Team t1 = Team.getTeamById(pb, 13); logger.info(t1: + t1); t.addSubTeam(t1); // // if the following line is active everything works fine. but if // the I store the Object t just once after adding all other Teams // only the last one is made persistent //t.store(); Team t2 = Team.getTeamById(pb, 7); logger.info(t2: + t2); t.addSubTeam(t2); t.store(); The other thing is: I also could reproduce this behaviour with relations where no association-class is involved. So the error can't be there. If you need more information please let me know. For now I have a workaround - but if this is an OJB-bug it should be solved. Regards Tino Armin Waibel wrote: Hi Tino, I wrote a quick test and can't reproduce the problem you described. The test do exactly what you described: - Movie m:n Actor - create an Movie object with dependent Actor objects - add already existing Actor's to the existing Movie object movie.getActors().add(a_1); movie.getActors().add(a_2); broker.beginTransaction(); broker.store(movie); broker.commitTransaction(); This test pass (see ...broker.M2NTest#testAddNewEntriesTTTF in CVS) This shouldn't be the problem, but do you avoid a RemovalAware Collection class in collection-descriptor? e.g. by setting collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList http://db.apache.org/ojb/docu/guides/basic-technique.html#Support+for+Non-Decomposed+m%3An+Mappings Please post more info (metadata mapping) regards, Armin Tino Schöllhorn wrote: Hi, several days ago I changed from RC6 to OJB 1.0.0 and so far it is running fine. But now I encounter a strange bug - something which has not happened with RC6. I have a class Team and there is a N-M-Relation between Teams and Subteam. Now I am adding some (already persistent) Teams t1...tn to another Team t: Team t = .. t.addSubTeam(t1); t.addSubTeam(t2); PersistenceBroker pb = pb.beginTransaction(); p.store(t); p.commitTransaction(); Before the update OJB inserted all necessary rows in the database. But now there only the *last* added Team persistent. The other thing is, that t1 is not in the cache either. But when I try to store Team t after each add-Statement the database and the object is correctly updated! So is this a bug or am I missing something? I suspect it is an error of OJB ?? Glad for any help. Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] !-- Team-- class-descriptor class=kos.intranet2.om.Team table=Team field-descriptor name=id column=TE_ID jdbc-type=INTEGER primarykey=true autoincrement=true access=readonly/ collection-descriptor name=subTeamLinks element-class-ref=kos.intranet2.om.TeamTeam auto-retrieve=true auto-update=object auto-delete=object orderby=position inverse-foreignkey field-ref=parentId/ attribute attribute-name=reverseReference attribute-value=parent/ /collection-descriptor /class-descriptor !-- Team End -- !-- TeamTeam -- class-descriptor class=kos.intranet2.om.TeamTeam table=Team_Team field-descriptor name=id column=TETE_ID jdbc-type=INTEGER primarykey=true autoincrement=true access=readonly/ field-descriptor name=position column=TETE_Position jdbc-type=INTEGER/ field-descriptor name=parentId column=TETE_Master jdbc-type=INTEGER access=anonymous/ field-descriptor name=childId column=TETE_Detail jdbc-type=INTEGER access=anonymous/ field-descriptor name=creationDate column=TETE_CreationDate jdbc-type=TIMESTAMP/ reference-descriptor name=parent class-ref=kos.intranet2.om.Team foreignkey field-ref=parentId/ attribute attribute-name=reverseCollection attribute-value=subTeamLinks/ /reference-descriptor reference-descriptor name=child class-ref
Inheritance: One Table
Hi, I have I inheritance-problem. I want to map two classes to one table. They are defined as followed: class A { int id; protected String ojbConcreteClass; // some attributes } class B extends A { // some additional attributes } I created class-descriptors for each of the table: class-descriptor class=A table=table // field-descriptors for A inluding ojbConcreteClass /class and class-descriptor class=B table=table extends=A // additional field-descriptors for B /class So: When I try to store an instance of Type A everything is fine. But when I try to store an instance of Type B OJB complains: Caused by: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: OJB needs at least one primary key attribute for class objectsRealClass=class kos.wnetz.om.RelationHistoryEvent, objectTopLevelClass=class kos.wnetz.om.RelationHistoryEvent at org.apache.ojb.broker.Identity.checkForPrimaryKeys(Identity.java:245) at org.apache.ojb.broker.Identity.init(Identity.java:121) So I also tried to include the field-descriptors of the superclass in the class-descriptor for class B. But then I get an even worse error: Caused by: java.sql.SQLException: Parameter index out of range (8 7). at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:1940) at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:1075) at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:766) at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:892) at org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatement(PlatformDefaultImpl.java:227) at org.apache.ojb.broker.platforms.PlatformMySQLImpl.setObjectForStatement(PlatformMySQLImpl.java:87) at org.apache.ojb.broker.accesslayer.StatementManager.bindInsert(StatementManager.java:449) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(JdbcAccessImpl.java:193) ... 47 more So obviously I am missing somthing. do you have any suggestions? Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Inheritance: One Table
Hi, unfortunately I still have one problem: I use a xml-parser to pre-validate the repository.xml-file. This Parser now complains that field-descriptors cannot be used when using extent. I checked that with the DTD and I think it is correct: !ELEMENT class-descriptor ((documentation?, extent-class+, attribute*) | (documentation?, object-cache?, extent-class*, field-descriptor+, reference-descriptor*, collection-descriptor*, index-descriptor*, attribute*, insert-procedure?, update-procedure?, delete-procedure?)) But the thing is: OJB works correctly. So what do I do now? Should I ignore this warning? Or do I have to create a not-persistent abstract superclass? Tino Thomas Dudziak wrote: Tino Schöllhorn wrote: Hi, I have I inheritance-problem. I want to map two classes to one table. They are defined as followed: class A { int id; protected String ojbConcreteClass; // some attributes } class B extends A { // some additional attributes } I created class-descriptors for each of the table: class-descriptor class=A table=table // field-descriptors for A inluding ojbConcreteClass /class and class-descriptor class=B table=table extends=A // additional field-descriptors for B /class So: When I try to store an instance of Type A everything is fine. But when I try to store an instance of Type B OJB complains: Caused by: org.apache.ojb.broker.metadata.ClassNotPersistenceCapableException: OJB needs at least one primary key attribute for class objectsRealClass=class kos.wnetz.om.RelationHistoryEvent, objectTopLevelClass=class kos.wnetz.om.RelationHistoryEvent at org.apache.ojb.broker.Identity.checkForPrimaryKeys(Identity.java:245) at org.apache.ojb.broker.Identity.init(Identity.java:121) So I also tried to include the field-descriptors of the superclass in the class-descriptor for class B. But then I get an even worse error: Caused by: java.sql.SQLException: Parameter index out of range (8 7). I don't know where this exception comes from, but in order to describe a super-subtype relationship you should use something like: class-descriptor class=A table=table extent-class class-ref=B/ // field-descriptors for A inluding ojbConcreteClass /class and class-descriptor class=B table=table // field-descriptors for B including ojbConcreteClass /class The extent-class is inverse to the extends/implements in Java (i.e. specified at the supertype), and also note that the class-descriptor for B contains all attributes of A (there is no automatic 'inheritance' of the descriptors in the repository.xml file) including the ojbConcreteClass attribute. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Deletion and Cache
Hi, I think this topic has been discussed before. But I am not sure what the current status is: I have two classes A and B. A has a Collection of Bs. Now if I delete a B object which is part of a Collection of an A object the B object is correctly deleted in the database and is also removed from the cache, BUT the A-Object still references the now deleted B-Object in its collection. From the disussion I am not sure if this is a bug (I am using rc6) or if I am just using the wrong Collection class (I am using ManageableArrayList). With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Collection creation and sorting
Hi Gelhar, the thing is: I have a decomposed N:M-relationship and the attributes after which I want to sort the collection are members of different classes! Any ideas? Tino Gelhar, Wallace Joseph wrote: Hi Tino, Sure you can do this. An example: class-descriptor class=BuildingImpl table=tblPlnBuilding ... collection-descriptor name=rooms element-class-ref=RoomImpl orderby name=roomNo sort=ASC / orderby name=roomSuffix sort=DESC / inverse-foreignkey field-ref=buildingId/ /collection-descriptor ... /class-descriptor Where roomNo and roomSuffix are attributes on the RoomImpl object. Wally -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Tino Schöllhorn Sent: Friday, April 30, 2004 2:41 AM To: [EMAIL PROTECTED] Subject: Collection creation and sorting Hi, I have a (probably simple) question about sorting collections: I have 3 classes which I successfully mapped to OJB: class Company { Collection companyTeams; public Collection getTeams() { //??? } } class CompanyTeam { Company c; Team t; int pos; } class Team { String name; Collection companyTeams; } Now I want to achieve the following: The method getTeams() of class Company should return all Teams of that Company *sorted by CompanyTeam.pos AND Team.name*. I know that I could write a quite complicated Comparator which just does that - but I have many other cases where I had to do that. And writing Comparators is not fun and is very error prone. Is there a way to tell OJB that it should load the Collections in a such ordered fashion? I know that one can specify several orderby attributes but is it also possible to specify the orderby attributes which are located in different tables? Or should I implement a QueryCustomizer? In hope for help. tino - 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]
Collection creation and sorting
Hi, I have a (probably simple) question about sorting collections: I have 3 classes which I successfully mapped to OJB: class Company { Collection companyTeams; public Collection getTeams() { //??? } } class CompanyTeam { Company c; Team t; int pos; } class Team { String name; Collection companyTeams; } Now I want to achieve the following: The method getTeams() of class Company should return all Teams of that Company *sorted by CompanyTeam.pos AND Team.name*. I know that I could write a quite complicated Comparator which just does that - but I have many other cases where I had to do that. And writing Comparators is not fun and is very error prone. Is there a way to tell OJB that it should load the Collections in a such ordered fashion? I know that one can specify several orderby attributes but is it also possible to specify the orderby attributes which are located in different tables? Or should I implement a QueryCustomizer? In hope for help. tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
CreationDate-Column for each Table
Hi, I have a (quite small) problem: I want that each table in my database has an attribute CreationDate which reflects the time when this row has been inserted. But I don't want to use any database-specific datatypes or functions. My current idea is really simple and uses the callback-mechanism: Each Java-Object gets an attribute creationDate which I can set to the correct value in the PeristenceBrokerAware.beforeInsert(PersistenceBroker) method. But with this approach I have one problem, how could I set the creationDate-values to the rows of N-M-Relations which I have not decomposed? Is there a way to extend the inserts of OJB, when OJB is creating those rows? Glad for any help! Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Rechtekonzept
Hallo, ich habe mal versucht, das Rechtekonzept nochmal zusammenzufassen. Wäre gut, wenn ihr Euch es mal anschauen würdet. Ihr findet es im Projekt 1.Release im Intranet unter dem Order Konzepte. Gruss Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: soft-deleting objects
Hallo Daniel, that sound great. But still I do have one question: how could you then load all non-deleted object *without* using the deleted-flag. I mean something like Criteria crit = new Criteria(); // I can use any criteria here but I don't want to have to use deleted Query q = QueryFactory.newQuery(MyClass, myCriteria); Collection objects = pb.getCollectionByQuery(q); // the result are all Objects which have the deleted-flag == false Any suggestions? regards Tino Daniel Perry wrote: I am using this in a complex app (due to idiot admin users deleting stuff they shouldnt!). All objects have a boolean (mapped to int) deleted. For all queries i look for objects with deleted=false. For relationships, i wrote a querycustomizer which adds deleted=false to collections. (see below example) It;s very simple and works a treat! If you have a 'base' bean, which all other beans inherit, you can put the 'deleted' attribute there, and can use a delete method for deleting any beans! (note: i dont use extents for this in the repository, just map it for all beans) collection-descriptor name=subFamilies element-class-ref=com.netcase.pdp.bo.JobSubFamily proxy=true inverse-foreignkey field-ref=jobFamilyId/ query-customizer class=com.netcase.pdp.ojb.NestedElementCustomQuery attribute attribute-name=equalsZeroField attribute-value=deleted/ attribute attribute-name=orderField attribute-value=name/ /query-customizer /collection-descriptor -Original Message- From: Brian McCallister [mailto:[EMAIL PROTECTED] Sent: 23 March 2004 14:01 To: OJB Users List Subject: Re: soft-deleting objects If you have a deleted style flag in the database for the soft delete you can probably accomplish this via a query customizer. If you mean to not flag the delete in the database at all, but only treat it as such in the application -- that is a bit trickier, but can probably be done via pb callbacks/row readers. -Brian On Mar 23, 2004, at 6:21 AM, Tino Schöllhorn wrote: Hi, I want to implement something like a soft-delete: Objects should be marked as deleted in its corresponing table and OJB should just ignore them when it is materializing or querying them. Where would be the best point to start when I want to implement this feature? I just played around with the RowReader-Concept - but I have the feeling that this is not the right place to start, because I think I have to modify the queries OJB is submitting to the database. Any ideas? Regards Tino - 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: soft-deleting objects
Hi, that sounds great. Is there a way to tell OJB that it always should use MyCriteria from the QueryFactory? Or do I have to implement an own version of it? Regards Tino Charles N. Harvey III wrote: Extend Criteria with a MyCriteria. public class MyCriteria extends Criteria { public MyCriteria() { addDeletedEqualTo( true ); } public addDeletedEqualTo( boolean bValue ) { this.addEqualTo( deleted, bValue ); } } Works for me. I usually create a Criteria object for each OJB Object that I have. I add a bunch of convenience methods to add values to the criteria. Charlie Tino Schöllhorn wrote: Hallo Daniel, that sound great. But still I do have one question: how could you then load all non-deleted object *without* using the deleted-flag. I mean something like Criteria crit = new Criteria(); // I can use any criteria here but I don't want to have to use deleted Query q = QueryFactory.newQuery(MyClass, myCriteria); Collection objects = pb.getCollectionByQuery(q); // the result are all Objects which have the deleted-flag == false Any suggestions? regards Tino Daniel Perry wrote: I am using this in a complex app (due to idiot admin users deleting stuff they shouldnt!). All objects have a boolean (mapped to int) deleted. For all queries i look for objects with deleted=false. For relationships, i wrote a querycustomizer which adds deleted=false to collections. (see below example) It;s very simple and works a treat! If you have a 'base' bean, which all other beans inherit, you can put the 'deleted' attribute there, and can use a delete method for deleting any beans! (note: i dont use extents for this in the repository, just map it for all beans) collection-descriptor name=subFamilies element-class-ref=com.netcase.pdp.bo.JobSubFamily proxy=true inverse-foreignkey field-ref=jobFamilyId/ query-customizer class=com.netcase.pdp.ojb.NestedElementCustomQuery attribute attribute-name=equalsZeroField attribute-value=deleted/ attribute attribute-name=orderField attribute-value=name/ /query-customizer /collection-descriptor -Original Message- From: Brian McCallister [mailto:[EMAIL PROTECTED] Sent: 23 March 2004 14:01 To: OJB Users List Subject: Re: soft-deleting objects If you have a deleted style flag in the database for the soft delete you can probably accomplish this via a query customizer. If you mean to not flag the delete in the database at all, but only treat it as such in the application -- that is a bit trickier, but can probably be done via pb callbacks/row readers. -Brian On Mar 23, 2004, at 6:21 AM, Tino Schöllhorn wrote: Hi, I want to implement something like a soft-delete: Objects should be marked as deleted in its corresponing table and OJB should just ignore them when it is materializing or querying them. Where would be the best point to start when I want to implement this feature? I just played around with the RowReader-Concept - but I have the feeling that this is not the right place to start, because I think I have to modify the queries OJB is submitting to the database. Any ideas? Regards Tino - 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: soft-deleting objects
Hi, I just tried what you suggested and it seems to work fine. 1.) I extended Criteria and use only my subclass to query extents 2.) I am using a QueryCustomizer to load only those references which have not been deleted. But now I encounter some more difficulties when I am using decomposed relations. I have a class Department. Departments can have subdeparments and I have an association-class DepartmentDepartment which store some information about the relationship. For the sake of clearity say I have the following departments: A, B, C (deleted) and relations A-C, A-B What I expect is, that when I access Department A it only has 1 departments (namely B) because C has been marked as deleted. But my (quite simple) query-customizer cannot handle this case. At the moment it is implemented like this: public Query customizeQuery( Object obj, PersistenceBroker pb, CollectionDescriptor cd, Query q) { Criteria res = new RespectDeletedCriteria(); Criteria org = q.getCriteria(); org.addAndCriteria(res); return QueryFactory.newQuery(q.getBaseClass(), org); } Do you have any suggestions how to handle this ? Tino Charles N. Harvey III wrote: I don't think you can tell OJB to always use a certain Criteria object. From your example below, I would change it to this: MyCriteria crit = new MyCriteria(); Query q = QueryFactory.newQuery( MyClass, crit ); Collection objects = pb.getCollectionByQuery( q ); As long as you always do new MyCriteria() instead of new Criteria() you should be fine. The only other thing I would suggest is to abstract the PersistenceBroker into a general use class so you don't have to instantiate it all the time. --- public class MyRepository { public MyRepository getInstance() { return new MyRepository(); } protected PersistenceBroker getPersistenceBroker() { PersistenceBroker broker = PersistenceBrokerFactory.createPersistenceBroker( this.pbKey ); return broker; } protected void releasePersistenceBroker( PersistenceBroker broker ) { if( broker != null ) broker.close(); } public Collection selectMyObjects( Class myClass ) throws OJBException {MyCriteria crit = new MyCriteria(); Query q = QueryFactory.newQuery( myClass, crit ); return selectObjects( q ); } public Collection selectObjects( Query query ) throws OJBException { PersistenceBroker broker = null; try { broker = this.getPersistenceBroker(); return broker.getCollectionByQuery( query ); } catch( Throwable e ) { throw new OJBException( e ); } finally { this.releasePersistenceBroker( broker ); } } } --- Then, your queries would be as simple as this: MyRepository repo = MyRepository.getInstance(); Collection objects = repo.selectMyObjects( MyClass.class ); Well, that's how I do it anyway. You might not like that as much. But that makes sure your queries are always the same, and I really like not having to fuss about with the PersistenceBroker all the time. Charlie Tino Schöllhorn wrote: Hi, that sounds great. Is there a way to tell OJB that it always should use MyCriteria from the QueryFactory? Or do I have to implement an own version of it? Regards Tino Charles N. Harvey III wrote: Extend Criteria with a MyCriteria. public class MyCriteria extends Criteria { public MyCriteria() { addDeletedEqualTo( true ); } public addDeletedEqualTo( boolean bValue ) { this.addEqualTo( deleted, bValue ); } } Works for me. I usually create a Criteria object for each OJB Object that I have. I add a bunch of convenience methods to add values to the criteria. Charlie Tino Schöllhorn wrote: Hallo Daniel, that sound great. But still I do have one question: how could you then load all non-deleted object *without* using the deleted-flag. I mean something like Criteria crit = new Criteria(); // I can use any criteria here but I don't want to have to use deleted Query q = QueryFactory.newQuery(MyClass, myCriteria); Collection objects = pb.getCollectionByQuery(q); // the result are all Objects which have the deleted-flag == false Any suggestions? regards Tino Daniel Perry wrote: I am using this in a complex app (due to idiot admin users deleting stuff they shouldnt!). All objects have a boolean (mapped to int) deleted. For all queries i look for objects with deleted=false. For relationships, i wrote a querycustomizer which adds deleted=false to collections. (see below example) It;s very simple and works a treat! If you have a 'base' bean, which all other beans inherit, you can put the 'deleted
Changing Loading Behaviour for N-M-Relations
Hi, I am trying to change the behaviour of loading N-M-Relations - but I have some trouble here. Essentially I have one class Department and a relationship subdepartment (so I have 2 tables Department and Department_Department). Now I want that OJB loads only those subdepartments of a Department D which have a certain flag set (here: deleted). I tried to use a QueryCustomizer to modify the Query - but I am stuck. I thought I could modify the Query which loads the relations in the way I want. But I don't know how to modify the QueryByMtoNCriteria-Object which comes by. I think this approach should work (at least it does with 1:N) - any suggestions? Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: soft-deleting objects
Hello Charles, honestly I don't understand how this could help me as I don't have any subclassing in my use-case. As I understand the mapping you showed me is for mapping class-hierarchies - which is definetely not what I want. But thank for your help anyway - I think I am on the right way now (using a custom Criteria and a QueryCustomizer). Tino Charles N. Harvey III wrote: Tino, Are your tables joined? It sounds like they should be. Like, department_id is the foreign key in SUB_DEPARTMENT. That's what it seems like the setup is. If so, you should take a look at this: http://db.apache.org/ojb/tutorial3.html#Mapping%20Classes%20on%20Multiple%20Joined%20Tables If your tables are setup this way, you can add criteria to your query based on either table. So... Criteria crit = new MyCriteria(); crit.addEqualTo( department, A ); // adds WHERE dept.department = 'A' crit.addEqualTo( deleted, false ); // adds WHERE sub.deleted = 'false' Take a look at the tutorial, its really helpful in describing better ways to setup your data and how to query it. Charlie Tino Schöllhorn wrote: Hi, I just tried what you suggested and it seems to work fine. 1.) I extended Criteria and use only my subclass to query extents 2.) I am using a QueryCustomizer to load only those references which have not been deleted. But now I encounter some more difficulties when I am using decomposed relations. I have a class Department. Departments can have subdeparments and I have an association-class DepartmentDepartment which store some information about the relationship. For the sake of clearity say I have the following departments: A, B, C (deleted) and relations A-C, A-B What I expect is, that when I access Department A it only has 1 departments (namely B) because C has been marked as deleted. But my (quite simple) query-customizer cannot handle this case. At the moment it is implemented like this: public Query customizeQuery( Object obj, PersistenceBroker pb, CollectionDescriptor cd, Query q) { Criteria res = new RespectDeletedCriteria(); Criteria org = q.getCriteria(); org.addAndCriteria(res); return QueryFactory.newQuery(q.getBaseClass(), org); } Do you have any suggestions how to handle this ? Tino Charles N. Harvey III wrote: I don't think you can tell OJB to always use a certain Criteria object. From your example below, I would change it to this: MyCriteria crit = new MyCriteria(); Query q = QueryFactory.newQuery( MyClass, crit ); Collection objects = pb.getCollectionByQuery( q ); As long as you always do new MyCriteria() instead of new Criteria() you should be fine. The only other thing I would suggest is to abstract the PersistenceBroker into a general use class so you don't have to instantiate it all the time. --- public class MyRepository { public MyRepository getInstance() { return new MyRepository(); } protected PersistenceBroker getPersistenceBroker() { PersistenceBroker broker = PersistenceBrokerFactory.createPersistenceBroker( this.pbKey ); return broker; } protected void releasePersistenceBroker( PersistenceBroker broker ) { if( broker != null ) broker.close(); } public Collection selectMyObjects( Class myClass ) throws OJBException {MyCriteria crit = new MyCriteria(); Query q = QueryFactory.newQuery( myClass, crit ); return selectObjects( q ); } public Collection selectObjects( Query query ) throws OJBException { PersistenceBroker broker = null; try { broker = this.getPersistenceBroker(); return broker.getCollectionByQuery( query ); } catch( Throwable e ) { throw new OJBException( e ); } finally { this.releasePersistenceBroker( broker ); } } } --- Then, your queries would be as simple as this: MyRepository repo = MyRepository.getInstance(); Collection objects = repo.selectMyObjects( MyClass.class ); Well, that's how I do it anyway. You might not like that as much. But that makes sure your queries are always the same, and I really like not having to fuss about with the PersistenceBroker all the time. Charlie Tino Schöllhorn wrote: Hi, that sounds great. Is there a way to tell OJB that it always should use MyCriteria from the QueryFactory? Or do I have to implement an own version of it? Regards Tino Charles N. Harvey III wrote: Extend Criteria with a MyCriteria. public class MyCriteria extends Criteria { public MyCriteria() { addDeletedEqualTo( true ); } public addDeletedEqualTo( boolean bValue ) { this.addEqualTo( deleted, bValue ); } } Works for me. I usually create a Criteria object for each OJB Object that I have. I add a bunch
soft-deleting objects
Hi, I want to implement something like a soft-delete: Objects should be marked as deleted in its corresponing table and OJB should just ignore them when it is materializing or querying them. Where would be the best point to start when I want to implement this feature? I just played around with the RowReader-Concept - but I have the feeling that this is not the right place to start, because I think I have to modify the queries OJB is submitting to the database. Any ideas? Regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
creationDate and lastUpdate for classes
Hi, I am successfully using OJB rc5 and I really appreciate this tool. Now I want to extend my data-model so that I have 2 additional fields: - creationDate: the date the object/row was created - lastUpdate: the date the object/row was last updated Currently we are using MySQL as database, but we don't want to use any database-specific functions so that I have to implement it myself. I identified several cases and one I can't imagine how to solve the maintainence of my two dates. 1.) Normal Object: say I have class A. via the interface PersistenceBrokerAware I can easily set creationDate and lastUpdate to the correct values. 2.) Decomposed NM-Relation between class A and B via class AC: well this is just another case of 1.) 3.) Non-Decomposed NM-Relation between class A and B: This is the case which puzzles me: is it possible to implement a callback mechanism or something like that, when inserting or updating this relationship? I would really be glad for any help! Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ConnectinPooling
Hi, I am using OJB(cvs head from 2 weeks ago) in Tomcat 5.0. There I have several PersistenceBroker which I close after each request with PersistenceBrokerFactory.realeaseAll(). After some time I get the following error: org.apache.ojb.broker.PBFactoryException: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=intranet_tk, user=sa, password=* at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker(PersistenceBrokerFactoryDefaultImpl.java:156) at org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(PersistenceBrokerFactory.java:125) at kos.wnetz.system.Parameter.getPBFromName(Parameter.java:945) at kos.wnetz.system.Parameter.getTokenPB(Parameter.java:289) at kos.wnetz.om.Adapter.getInstance(Adapter.java:36) at kos.wnetz.system.Parameter.createInstance(Parameter.java:842) at kos.wnetz.system.Parameter.createInstance(Parameter.java:781) at kos.wnetz.system.Parameter.createInstance(Parameter.java:865) at kos.wnetz.servlets.WNetz.doRequest(WNetz.java:91) at kos.wnetz.servlets.WNetz.doGet(WNetz.java:61) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) . But the thing is: I don't even use connection pooling (or so I think). I activated the line ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl in the OJB.properties file. So I think, that ConnectionPooling is switched off. Or do I have to change these settings in the connection-descriptors? Do you have any suggestions? Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ConnectinPooling
Hi, thanks. I wasn't aware of the PeristenceBrokerPool concept. regards Tino Armin Waibel wrote: Hi Tino, Tino Schöllhorn wrote: Hi, I am using OJB(cvs head from 2 weeks ago) in Tomcat 5.0. There I have several PersistenceBroker which I close after each request with PersistenceBrokerFactory.realeaseAll(). Why you do that? This will kill the PB pool (PB pool NOT connection pool) each time you call it. After some time I get the following error: Maybe it's because you kill the PB-pool or you don't close the PB instances after use with PB.close() and the PB-pool gets exhausted. ... But the thing is: I don't even use connection pooling (or so I think). I activated the line ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryNotPooledImpl in the OJB.properties file. So I think, that ConnectionPooling is switched off. Or do I have to change these settings in the connection-descriptors? Do you have any suggestions? If you don't want to use Connection pooling set the property in OJB.properties (you do that). Now connections will not be pooled. Connections will be closed after use on PB.commitTransaction, PB.abortTransaction or PB.close(). So if you need a PB instance get it from PBF, do your work and *close* the used PB instance (internal OJB return the used PB instance to PB-pool). regards, Armin Tino - 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: FunctionSequenceError and MSAccess
Hello Armin, here is the stacktrace: org.apache.ojb.broker.PersistenceBrokerSQLException: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Fehler in der Funktionsreihenfolge. org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeUpdate(JdbcAccessImpl.java: 551) org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBrokerImpl.java: 1441) org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java: 1341) org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java: 700) org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersistenceBroker.java: 165) org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersistenceBroker.java: 165) kos.generator.DataObject.storeInstance(DataObject.java: 68) kos.wnetz.modules.fs2.FileSystem.saveFileProperties(FileSystem.java: 231) sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java: no source available) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) java.lang.reflect.Method.invoke(Method.java: 324) kos.wnetz.system.Action.invoke(Action.java: 234) kos.wnetz.system.ActionHandler.invoke(ActionHandler.java: 42) kos.wnetz.servlets.WNetz.doRequest(WNetz.java: 98) kos.wnetz.servlets.WNetz.doPost(WNetz.java: 74) javax.servlet.http.HttpServlet.service(HttpServlet.java: 763) javax.servlet.http.HttpServlet.service(HttpServlet.java: 856) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java: 284) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java: 204) ... 22 weitere Elemente... Tino Armin Waibel wrote: Hi Tino, Tino Schöllhorn wrote: Hi, I am using OJBrc5 (rebuild from CVS head) and I have some troubles with my database: sometimes (not always) when I want to insert or update an object via ojb the JdbcOdbcBridge throws an function sequence error. From my previous experiences this error occurs when a resultset r is read and the statement which produced the resultset r is already closed. Could you post the stack trace? regards, Armin I already tried to switch off connection-pooling. But now I am helpless. Any ideas? Tino - 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]
QueryFactory issue
Hi, I could pinpoint the described error which has been described in an earliear thread (Cache issue: 13.2.2004). It all boils to the QueryFactory.newQuery(Class, Criteria, boolean) method. if I execute the code to retrieve an instance of class Person with: Criteria crit = new Criteria(); crit.addEqualTo(id, 85); Query query = QueryFactory.newQuery(Person.class, crit); Collection c = pb.getCollectionByQuery(query); and so on everything works perfectly and the instances of Person are instantiated correctly. But if I use the method described in the first place: Criteria crit = new Criteria(); crit.addEqualTo(id, 85); Query query = QueryFactory.newQuery(Person.class, crit, true); After that query the LONGVARCHARS aren't correctly instantiated. I think that this might be an error of OJB. With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: QueryFactory issue
Hi, sorry I got it. It is a database-error. Access doesn't return memo fields when using distinct (g). my fault. tino Tino Schöllhorn wrote: Hi, I could pinpoint the described error which has been described in an earliear thread (Cache issue: 13.2.2004). It all boils to the QueryFactory.newQuery(Class, Criteria, boolean) method. if I execute the code to retrieve an instance of class Person with: Criteria crit = new Criteria(); crit.addEqualTo(id, 85); Query query = QueryFactory.newQuery(Person.class, crit); Collection c = pb.getCollectionByQuery(query); and so on everything works perfectly and the instances of Person are instantiated correctly. But if I use the method described in the first place: Criteria crit = new Criteria(); crit.addEqualTo(id, 85); Query query = QueryFactory.newQuery(Person.class, crit, true); After that query the LONGVARCHARS aren't correctly instantiated. I think that this might be an error of OJB. With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cache issue
Hello Armin, I could pinpoint the described error. It all boils to the QueryFactory.newQuery(Class, Criteria, boolean) method. if I execute the code to retrieve an instance of class Person with: Criteria crit = new Criteria(); crit.addEqualTo(id, 85); Query query = QueryFactory.newQuery(Person.class, crit); Collection c = pb.getCollectionByQuery(query); and so on everything works perfectly and the instances of Person are instantiated correctly. But if I use the method described in the first place: Criteria crit = new Criteria(); crit.addEqualTo(id, 85); Query query = QueryFactory.newQuery(Person.class, crit, true); After that query the LONGVARCHARS aren't correctly instantiated. I think that this might be an error of OJB. With regards Tino Armin Waibel wrote: Hi, Tino Schöllhorn wrote: Hi, I have (again) something weird which I suppose is just a configuration problem: I have a class Person which has one LONGVARCHAR-Field. The first time the object is accessed the LONGVARCHAR-field is returned correctly. hmm, does this mean first time after creation? Which cache was used? Maybe first time after store it was found in cache, second time it was read from DB. So I assume your database truncate the String on insert. Maybe I'm wrong ;-) regards, Armin But the second time it is accessed it returns just 256 (I suppose) characters. I am using Access as 'database' but I don't think this is the problem. Do you have any ideas what I could try? Tino - 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]
Cache Bug with multiple PersistenceBrokers?
Hi, I have a very, very strange phenomenom: I have one web-application which handles several clients. Each client uses its own database, but the database schema is always the same. Our web-application handles requests for all clients, so I have to switch the PersistenceBroker as soon as I notice that another client should be handled. This generally works fine when testing one client, but when testing other clients simultanously data of client A appears in the results of client B and vice versa. The most funny (?) thing is that the visible data switches from client A to client B after a few clicks. Is it possible that the cache ojb-uses doesn't respect the different PersistenceBrokers? That would explain the described behaviour. How could I turn off the cache, so I can verify this ? Do you have other ideas which I might try ? I am using ojb1.0rc5 With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Blobs and MSAccess
Hi, has anyone tried using OJB with MSAccess and can successfully handle BLOBs? I am wondering if I could use OJB to handle this. With regards Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Checking repository.xml with dtd
Hello Armin, that was ist thank. But: isn't that nuts? I wasn't aware that the order of elements in an xml-file has anything to do with its corectness. regards Tino Armin Waibel wrote: Hi Tino, (I'm not an xml-expert ;-) ) try to keep the order of elements declared in repository.dtd !ELEMENT class-descriptor ((documentation?, extent-class+, attribute*) | (documentation?, object-cache?, extent-class*, field-descriptor+, reference-descriptor*, collection-descriptor*, index-descriptor*, attribute*, insert-procedure?, update-procedure?, delete-procedure?)) First all reference-descriptor, then all collection-descriptor regards, Armin Tino Schöllhorn wrote: Hi, I want to ensure that the repository.xml-file is syntactically (is that english) correct. So I am trying to validate it against its dtd with the following code: DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(true); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(new ErrorHandler() { // some error handling code here }); Document doc = builder.parse(new File(repositoryFile)); Whenever I start this with my repositoy.xml file I get the following messages: ERROR: 30:-1 :org.xml.sax.SAXParseException: In Element class-descriptor ist hier reference-descriptor nicht zulässig. [ojb-generator] ERROR: 40:-1 :org.xml.sax.SAXParseException: In Element class-descriptor ist hier reference-descriptor nicht zulässig. So it seems that there is an error in my xml-file: but it works fine and the repository.dtd says that referecne-descriptor should be a valid element. Nontheless the application is running fine with my repository.xml-file - so I don't think there is an error. For those who are interested I attach the repository_user.xml file. What am I missing ? Thanks for any help. Tino class-descriptor class=kos.om.Person table=Person field-descriptor name=id column=PE_ID jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=name column=PE_NAME jdbc-type=VARCHAR/ field-descriptor name=description column=PE_Beschreibung jdbc-type=LONGVARCHAR/ field-descriptor name=surname column=PE_SURNAME jdbc-type=VARCHAR/ field-descriptor name=birthPlaceId column=PE_Geburtsort jdbc-type=INTEGER access=anonymous/ field-descriptor name=creationDate column=PE_ErstDatum jdbc-type=TIMESTAMP/ field-descriptor name=birthDay column=PE_Geburtstag jdbc-type=DATE/ field-descriptor name=deleted column=PE_geloescht jdbc-type=BIT/ field-descriptor name=fatherId column=PE_Vater jdbc-type=INTEGER access=anonymous/ !-- N:M - Relation -- collection-descriptor name=departments element-class-ref=kos.om.Department auto-retrieve=true auto-update=true auto-delete=false proxy=true indirection-table=Department_Person fk-pointing-to-this-class column=DEPE_Person/ fk-pointing-to-element-class column=DEPE_Department/ attribute attribute-name=reverseCollection attribute-value=persons/ /collection-descriptor !-- 1: N - Relation: 1er Seite -- reference-descriptor name=birthPlace class-ref=kos.om.City auto-retrieve=true auto-update=true foreignkey field-ref=birthPlaceId/ attribute attribute-name=reverseCollection attribute-value=bornPeoples/ /reference-descriptor reference-descriptor name=father class-ref=kos.om.Person auto-retrieve=true auto-update=true foreignkey field-ref=fatherId/ /reference-descriptor collection-descriptor name=children element-class-ref=kos.om.Person auto-retrieve=true auto-update=true proxy=true inverse-foreignkey field-ref=fatherId/ /collection-descriptor /class-descriptor class-descriptor class=kos.om.Department table=Department field-descriptor name=id column=DE_ID jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor name=name column=DE_NAME jdbc-type=VARCHAR/ collection-descriptor name=persons elemgent-class-ref=kos.om.Person auto-retrieve=true auto-update=false indirection-table=Department_Person fk-pointing-to-this-class column=DEPE_Department/ fk-pointing-to-element-class column=DEPE_Person/ attribute attribute-name=reverseCollection attribute-value=departments/ /collection-descriptor collection-descriptor name=subDepartments element-class-ref=kos.om.Department auto-retrieve=true auto-update=false indirection-table=Department_Department fk-pointing-to-this-class column=DEDE_Master/ fk-pointing
Re: Using VerifyMappingTask
Hello Armin, is there another way to verify the mappings which is not outdated? regards, Tino Armin Waibel wrote: Hi Tino, the VerifyMappingsTask is a little bit outdated, thus I don't know if you will get an adequate result. regards, Armin Tino Schöllhorn wrote: Hi, I want to automatically check the integrity of the repository.xml file and the corresponding database-mapping. So I tried out the VerifyMappingTask which is includes in the OJB-distribution (I am using rc5). But I am having problems with the classpath. Here is the situation: - My persistent classes inherit from a class kos.generator.DataObject which is provided in an extra JAR. - I set up the follwing ant-target: target name=verify-schema depends=init taskdef name=verifymappings classname=org.apache.ojb.broker.ant.VerifyMappingsTask classpath refid=project.class.path/ /taskdef path id=verify.classpath pathelement location=${lib}/ojb-generator.jar/ pathelement location=bin/ /path property name=verify.classpath.property refid=verify.classpath/ verifymappings propertiesFile=${conf}/OJB.properties repositoryFile=${conf}/repository.xml jdbcDriver=sun.jdbc.odbc.JdbcOdbcDriver url=jdbc:odbc:kos_db logon=sa password= ignoreFieldNameCase=true useStrictTypeChecking=false verifyclasspath=${verify.classpath.property} useXMLValidation=true failonerror=true/ /target == With these setting the task starts to run cleanly, and it seems to start checking but then it stops with: BUILD FAILED: java.lang.NoClassDefFoundError: kos/generator/DataObject I already tried to change the classpath in some ways, but that doesn't help (I even have the ojb-generator.jar in the ant boot-classpath). Does anyone have an idea what I am doing wrong? Tino - 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]
Using VerifyMappingTask
Hi, I want to automatically check the integrity of the repository.xml file and the corresponding database-mapping. So I tried out the VerifyMappingTask which is includes in the OJB-distribution (I am using rc5). But I am having problems with the classpath. Here is the situation: - My persistent classes inherit from a class kos.generator.DataObject which is provided in an extra JAR. - I set up the follwing ant-target: target name=verify-schema depends=init taskdef name=verifymappings classname=org.apache.ojb.broker.ant.VerifyMappingsTask classpath refid=project.class.path/ /taskdef path id=verify.classpath pathelement location=${lib}/ojb-generator.jar/ pathelement location=bin/ /path property name=verify.classpath.property refid=verify.classpath/ verifymappings propertiesFile=${conf}/OJB.properties repositoryFile=${conf}/repository.xml jdbcDriver=sun.jdbc.odbc.JdbcOdbcDriver url=jdbc:odbc:kos_db logon=sa password= ignoreFieldNameCase=true useStrictTypeChecking=false verifyclasspath=${verify.classpath.property} useXMLValidation=true failonerror=true/ /target == With these setting the task starts to run cleanly, and it seems to start checking but then it stops with: BUILD FAILED: java.lang.NoClassDefFoundError: kos/generator/DataObject I already tried to change the classpath in some ways, but that doesn't help (I even have the ojb-generator.jar in the ant boot-classpath). Does anyone have an idea what I am doing wrong? Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using VerifyMappingTask
Hi Thomas, thanks for your answer. I checked again, but still I get a NoClassDefFoundError. Unfortuanately there is not stacktrace so it is quite difficult to find it. The class kos.generator.DataObject is located in the ojb-generator.jar file. This jar is correct because I am using this JAR at several targets in my build-file. The -v option of ant does'nt help either. I changed the setting verifyclasspath to verifyClassPath but noting changes. Still the task says that it is adding my JARs to its classloader. Do you have more ideas what I could do? Tino Thomas Dudziak wrote: First, you can always invoke ant with the -v option for more information (or even -debug for usually way too much information). Second, I see in the source of the verify task that the classpath option of the task is called 'verifyClassPath' whereas you have 'verifyclasspath' (note the lowercase). Third, you did not write where the kos.generator.DataObject class is located. If its in the ojb-generator.jar file, then you should check whether the classpath works, for instance by using the java task to invoke this class with the same classpath you're using for the verify task. If you still get a NoClassDefFoundError than you have an error in either the jar or the classpath. If you get an error about that there is no main in the class file, then it might be a bug in the verify task itself. If its not in the ojb-generator.jar file, then you should add the jar containing the class explicitly to the classpath. Hope that helps, Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Starting applicatio via ant
Hi, I have a quite strange problem: I am trying to start an ojb-based application via ant and the commons-laucher tool. I have struggled some time with setting the classpath correctly and it works now fine - except for one ugly thing: I had to pass an ABSOLUTE path in the OJB.properties -file where OJB should look after its repository.xml-file. So I have somthing like this: repositoryFile=D:\\develop\\Tomcat-5.0\\webapps\\kos\\WEB-INF\\classes\\repository.xml But I really want to keep the relative path! If I use the relative path OJB tries to search the repository.xml-file from the directory where I started ant... So does anyone have an idea what I missed? Any help is greatly appreciated Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Design Pattern for referential integrity
Hi there, this is a topic which is not specifically bound to ojb - but since there are a lot of users out there who might have the same problem (and hopefully a solution) I post this message here: I have several classes which I use to map tables to objects. Now I am wondering what the most appropriate design pattern for referential integrity is. An example. Suppose we have two classes which implement a N:M-Relation: class A { Collection bs; void addB(B b) { bs.add(b); } void removeB(B b) { bs.remove(b); } } // the class B is the same as above. Now I'd like to use these classes. But there is one problem: When using these simple classes I have to write: A a = new A(); B b = new B(); a.addB(b); b.addA(a); so that one can navigate from both instances to each other. But I juest want to write: a.addB(b); And the changes should also be reflected in object b. Does anyone know a design pattern for this (quite common) problem? Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Weird Error in Access with Memo-Fields
Hi, I am using OJB and Access at the moment. So far everything worked fine, and I can also store memofields to the database. Now I integrated my classes in a web-application and there I get a really strange behaviour, when I save my data to the database: A) When I start Tomcat (5.0) and edit an entry and save it everything works fine. The data is written correctly to the database. B) When I try to edit again another or the same entry I get the typical error when the repository_user.xml file is not correctly set up: but all my necessary fiels are set to LONGVARCHAR. The error message is something like that: org.apache.ojb.broker.PersistenceBrokerSQLException: [Microsoft][ODBC Microsoft Access Driver]Die Zeichenfolgedaten wurden rechts abgeschnitten. (null) org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeUpdate(JdbcAccessImpl.java: 479) org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBrokerImpl.java: 1996) org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java: 1889) org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java: 665) org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollectionObject(PersistenceBrokerImpl.java: 855) org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(PersistenceBrokerImpl.java: 814) org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBrokerImpl.java: 2007) org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java: 1889) org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java: 665) org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollectionObject(PersistenceBrokerImpl.java: 855) org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(PersistenceBrokerImpl.java: 814) org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(PersistenceBrokerImpl.java: 2007) org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java: 1889) org.apache.ojb.broker.core.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java: 665) org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersistenceBroker.java: 160) org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(DelegatingPersistenceBroker.java: 160) kos.wnetz.wwnavi.WWEntity.save(WWEntity.java: 285) sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java: no source available) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) What I tried next was to view the behaviour of the PlatformMsAccessImpl class: What I noticed there that the second time the data was about to be store ther was no output of this class (I coded some low level debugging messages). Does anyone know if this is an error of OJB or what am I doing wrong? tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Deletion Bug!!!!!?
Hi Olli, and what about changing the default behaviour again? Honestly I think it is pretty dangerous because when I want to remove a relation I just want to remove this relation. It is another thing when I remove an instance of a class - then the default behaviour could delete the relations as well - but the deletion of the main-instance when removing a relation to it is really discomforting. Tino - Original Message - From: [EMAIL PROTECTED] Newsgroups: gmane.comp.jakarta.ojb.user Sent: Friday, November 28, 2003 9:09 AM Subject: RE: Deletion Bug!? Hello, -Original Message- thanks - I think that was the solution. But I don't think that it was intended by the developers of OJB that OJB deletes instances by default, or was it? no it was not, so OJB did not do it. Then a lot of users complained, so we changed it. That was probably a mistake. Now it is one of the most frequently asked questions. Just search the mailing list archives for 'RemovalAware' or the like. Olli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Deletion Bug!!!!!?
Hi, I have a really weird problem and I don't if I am doing something wrong or if this is a bug of OJB. I have basically 2 classes: Person and Department. I defined a N:M relation between those two. Now I want to remove a Department from a Person. But what happens is, that OJB is trying to delete ALL relations to other classes and is then deleting the Department as well!!! Do I have to change my configuration? Or is this a bug? In hope for help. Tino - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re:Deletion Bug!!!!!?
Hi, the autodelte flag is set to false. Here is my complete collectin-descriptor !-- N:M - Relation Company-Person -- collection-descriptor name=persons element-class-ref=kos.intranet2.om.Person auto-retrieve=true auto-update=true auto-delete=false proxy=true indirection-table=Company_Person fk-pointing-to-this-class column=COPE_Company/ fk-pointing-to-element-class column=COPE_Person/ /collection-descriptor Any ideas? Tino - Original Message - From: balza [EMAIL PROTECTED] Newsgroups: gmane.comp.jakarta.ojb.user Sent: Thursday, November 27, 2003 4:06 PM Subject: Re:Deletion Bug!? autodelete flag in your xml mapping file is true or false? an example: ... reference-descriptor name=country class-ref=allibo.logistic.Country auto-retrieve=true auto-update=true auto-delete=true ... Hi, I have a really weird problem and I don't if I am doing something wrong or if this is a bug of OJB. I have basically 2 classes: Person and Department. I defined a N:M relation between those two. Now I want to remove a Department from a Person. But what happens is, that OJB is trying to delete ALL relations to other classes and is then deleting the Department as well!!! Do I have to change my configuration? Or is this a bug? In hope for help. Tino - 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: Deletion Bug!!!!!?
Hi, thanks - I think that was the solution. But I don't think that it was intended by the developers of OJB that OJB deletes instances by default, or was it? Tino - Original Message - From: Philippe Boisaubert [EMAIL PROTECTED] Newsgroups: gmane.comp.jakarta.ojb.user Sent: Thursday, November 27, 2003 4:16 PM Subject: Re: Deletion Bug!? Always the same question, I ask it few days ago ! First you need to configure your repository (with auto-delete=false), i think you've already do this. Then use the ManagedArrayList as a collection class (by default it's a RemovalAwareCollection) like this (as an a attribute of the collection descriptor element): collection-class= org.apache.ojb.broker.util.collections.ManageableArrayList - Original Message - From: TINO SCHÖLLHORN [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 27, 2003 3:57 PM Subject: Deletion Bug!? Hi, I have a really weird problem and I don't if I am doing something wrong or if this is a bug of OJB. I have basically 2 classes: Person and Department. I defined a N:M relation between those two. Now I want to remove a Department from a Person. But what happens is, that OJB is trying to delete ALL relations to other classes and is then deleting the Department as well!!! Do I have to change my configuration? Or is this a bug? In hope for help. Tino - 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: MS Access Memo Field
Graham Lounder [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hey all,Hi, as I can see you only have to set the data-type in your repository.xml of the memo-field to LONGVARCHAR. I have had the same problem, but now it is running fine. Tino I'm trying to save a string greater than 255 characters to a MS Access memo field with no luck. I'm getting the following error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]String data, right truncated (null) I've done some search on the internet and it seems this is a problem without many solutions. I did notice that this was suppose to be fixed in rc4. I did read that someone said that it might have something to do with the autocommit setting? Any Ideas? Graham Graham Lounder - Java Developer CARIS Spatial Components Division [EMAIL PROTECTED] Phone: (506) 458-8533 Fax:(506) 459-3849 NO BINDING CONTRACT WILL RESULT FROM THIS EMAIL UNTIL SUCH TIME AS A WRITTEN DOCUMENT IS SIGNED ON BEHALF OF THE COMPANY. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Optional Feature not implemented
Hi, currently I am using OJB 1.0rc4 for the object-relational mapping with MS Access an the Jdbc-Odbc-Bridge from SUN. I know that there are some issues with this database but nonetheless I have to make OJB working with it. So far everything worked quite well and I couldn't find any of those discussed issues. I even could use the data-type LONGVARCHAR for long text fields. But now I get an error where I did not expect any problems: I want to delete a relation (n:m) from the database. So I use the following code to delete the relation between a person and a department: PersistenceBroker pb = PersistenceBrokerFactory.defaultPersistenceBroker(); pb.beginTransaction(); Person p= Person.getObjectById(pb, 84); Department del = Department.getObjectById(pb, 12); p.removeDepartment(del); pb.store(tino); pb.commitTransaction(); When trying to commit the transaction I get the following error: java.sql.SQLException: SQL Exception : [Microsoft][ODBC Microsoft Access Driver]Optionales Feature wurde nicht implementiert. [org.apache.ojb.broker.accesslayer.JdbcAccessImpl] ERROR: SQLException during the execution of the Update SQL query (for a kos.om.Person): SQL Exception : [Microsoft][ODBC Microsoft Access Driver]Optionales Feature wurde nicht implementiert. SQL Exception : [Microsoft][ODBC Microsoft Access Driver]Optionales Feature wurde nicht implementiert. at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement. java:1437) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement. java:1072) at org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatement(Un known Source) at org.apache.ojb.broker.platforms.PlatformMsAccessImpl.setObjectForStatement(U nknown Source) at org.apache.ojb.broker.accesslayer.StatementManager.bindValues(Unknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeUpdateSQL(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.deleteMtoNImplementor(Unkno wn Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeCollections(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown Source) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown Source) at DeleteTest.listA(DeleteTest.java:56) at TestBase.runTests(TestBase.java:28) at TestBase.main(TestBase.java:46) So do you have any ideas how to delete those relations from the database? With regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]