Re: java.lang.NullPointerException after calling getCollectionFromQuery()
Christopher Cheng wrote: I found the following exception after running the web application for days. snip/ Caused by: java.lang.NullPointerException at com.jnetdirect.jsql.am.clearParameters(Unknown Source) This is a JDBC-driver exception and is probably caused by a server-side dropped Connection object getting reused from pool due to a missing validation query. You need a validation query for your connection pool to avoid this. Since you are using a DataSource, you cannot directly specify the validation query in OJB - instead you will have to configure you DataSource to use it. However, since the concept of a validation query also applies when using OJB connection pooling you can google for [ojb validation query] to get some recent user-list discussions regarding this. A direct link to a recent thread: http://www.mail-archive.com/ojb-user@db.apache.org/msg13521.html You can use the same validation query (ie SELECT 1) for MS SQL Server as the specified MySQL example. Since your stacktrace shows com.caucho.sql I take it that you use Resin for your DataSource definition and connection pooling? If so, check Resin docs for how to configure the validation query: http://www.caucho.com/resin-3.0/db/config.xtp#Core-Configuration http://www.caucho.com/resin-3.0/db/config.xtp#reliability (The concept of performing 'validation queries' seems to be called pinging in Caucho terminology. It also seems that ping=true equals Apache Commons Pool setting of testOnBorrow=true.) Regards, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bidirectional 1:1 mapping not working with OJB?
Torsten Liermann wrote: I need a bi-directional mapping between 'Project' - 'ProjectTeam'. OJB set the relation form 'Project' to 'ProjectTeam' nice, but the link from 'ProjectTeam' to 'Project' was not updated. What is wrong? Thanks for help. Tell us a bit more about your use-case, specifically which OJB API you use (PB-API?, ODMG?) and some meta code for what you do. Regards, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to shutdown OJB when stopping web context.
Nathan Smith wrote: I cannot quite remember what the problem was, but it had something to with Iterators not returning all objects or Collections being returned containing no objects, but thats better left for another time at the moment. Aha, this smells like objects of class OJBIterator returned when using PB-API and report-queries or iterating Collections that are using proxy objects in OJB. In OJB 1.0.x the API will specify Iterator as return type so you have to do a somewhat ugly cast to (OJBIterator) and call #releaseDbResources() if you want to free resources from unexhausted [*] iterators before #finalize() and auto-release. [*] You can also exhaust the iterator by always iterating to the end, which will also trigger a fast release of any DB-resources (including ResultSet and thus implicitly Connection) when the iterator reaches the end. It could be because of constructs like: while (ojbiter.hasNext()) { ojbiter.next(); if (condition) { break out; == late release, did not exhaust iterator } } Or: ojbiter = broker.getReportQueryIteratorByCriteria(crit); Object onlyOneExpected = ojbiter.next(); // late release, did not exhaust iterator If you are using Oracle it should become obvious very fast if you have delayed release of resources in some Iterator objects, as this will keep the Oracle server-side cursors allocated and you will very fast get an SQLException with MAX_CURSORS_EXCEEDED. Any more suggestions? You could also try using the abandoned-config in DBCP and set a very short threshold time to log connection leaks, although it's difficult to say what the threshold should be if you really want to hold on to some connections a bit longer. Regards, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: urgent 3 level Inheritance problem
Ziv Yankowitz wrote: is it possible to configure OJB not to store the references in a Map. Without going into your detailed question; I think you should be able to work around any problems by implementing equals and hashCode in your beans such that instance of A.equals(instance of B) or instance of A.eqauls(instance of C) etc never returns true. Regards, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: urgent 3 level Inheritance problem
Ziv Yankowitz wrote: I tried to implement the hashCode and equals and it still doesn't work, somehow the beforeImage and the currentImage are working with the same instance of the AnonymousPersistentFieldForInheritance object in map. Silly me. Since your beans are not the objects stored in the Map, your definition of equals() does not matter. Sorry to give you false hope. ;) I hope that Jakob or others can help you with some details re the OJB implementation in that area. Regards, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]