Re: what's with OJB Project?
Hello, I also have been working with ojb for many years now and also worked with hibernate but only when I have to. Ojb has a marketing problem but for me that is not a problem. To tell you the truth there is nothing missing in Ojb, it does exactly what I need, no more no less. Best Regards, Dennis
Re: QueryBySQL
Hi, you could create a view and map that on a class that represents that view, then you dont need QueryBySQL. regards, Dennis 2007/7/24, krupa [EMAIL PROTECTED]: Hi All, I have several SQLs already written. I want to use QueryBySQL to use the existing SQLs. The problem I am facing is how do I map the result set of these queries to my java classes, especially if I have a result set that includes fields from 3 tables then how do I map this in the reposity.xml file? Please help me with this. here is an example of my SQL statement. select A1.field1, A1.field2, A1.field3,A2.field1, A2.field2,A2.field3,A2.field4, A3.field1 as tmp1, A3.field2 as tmphdr2 from (((Table1 left outer join table2 on field1= field2) left outer join table2 A2 on field2 = A2.field2) left outer join table2 A3 on field5= A3.field2) left outer join table2 A4 on field6 = A3.field2 where field1= 12 and field8 = ''A'' order by field9 ; Thanks, Krupa -- View this message in context: http://www.nabble.com/QueryBySQL-tf4137474.html#a11768006 Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
Re: massive performance problem with q.setStartAtIndex() and q.setEndAtIndex()
I think that is because ojb does not add the LIMIT thing to the query. Only the objects in the range are materialized but everything is selected from the DB. I guess it is becasue it is not standard SQL, every DB has its own way. 2007/3/20, Björn Agel [EMAIL PROTECTED]: hi there, i figured out a performance problem with large tables using q.setStartAtIndex() and q.setEndAtIndex() there are more than 100.000 entries in the table and a simple search which should return about 90.000 items still takes more than 10(!) seconds. i am using the index methods to retrieve only 10 datasets per query out of these 90.000 total items using an iterator. when i implement the same query directly as a sql command like: SELECT * FROM user WHERE name LIKE '%name%' LIMIT 5,10 the query takes less than 1 second ... am i doing something wrong or is it a bug ? with best regards, Björn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
Re: Borrow broker from pool failed. in production server
when i have a quick look it seems to be about the broker pool and not the connection pool. Check your OJB.properties and set maxActive to the same value as maxActive of the connection pool settings in repository_database.xml. I am not sure about it but your problem happened to me once this way and it was solved by doing as i suggest. regards, Dennis 2006/10/26, Marwane [EMAIL PROTECTED]: hi we have a web application on production used about 500 users. we use default value of ojb parameters (maxActif: 100 ). we are getting frequently the message indicating that we can't borrow connection from pool. even if we use maxActif in 1000 the problem persist. we need your help and give us some leads. stack trace : org.apache.ojb.broker.PBFactoryException: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=db2bmce, password=* at java.lang.Throwable.init(Throwable.java:195) at java.lang.Exception.init(Exception.java:41) at java.lang.RuntimeException.init(RuntimeException.java:43) at org.apache.commons.lang.exception.NestableRuntimeException.init( NestableRuntimeException.java:86) at org.apache.ojb.broker.OJBRuntimeException.init(Unknown Source) at org.apache.ojb.broker.PBFactoryException.init(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker(Unknown Source) at org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker(Unknown Source) at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown Source) at ma.co.omnidata.framework.services.dao.ojb.OJBPersistenceService.getBroker( OJBPersistenceService.java:156) at ma.co.omnidata.framework.services.dao.ojb.OJBPersistenceService.newSession( OJBPersistenceService.java:250) at ma.co.omnidata.framework.services.transaction.impl.TransactionManagerImpl.getTransaction (TransactionManagerImpl.java:39) at ma.co.omnidata.framework.services.businessInterface.OMNIFacade.invokeService (OMNIFacade.java:55) at ma.co.omnidata.framework.services.ihm.struts.core.OMNIBaseAction.invokeBusiness (OMNIBaseAction.java:120) at com.rmawatanya.convergence.application.technique.habilitation.ihm.action.HabLogonAction.doExecute (HabLogonAction.java:47) at com.rmawatanya.convergence.application.technique.habilitation.ihm.action.HabLogonAction.execute (HabLogonAction.java:35) at org.apache.struts.action.RequestProcessor.processActionPerform( RequestProcessor.java:421) at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:226) at org.apache.struts.action.ActionServlet.process(ActionServlet.java :1164) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:851) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service( ServletWrapper.java:1246) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest( ServletWrapper.java:380) at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest( CacheServletWrapper.java:80) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java :1724) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready( WCChannelLink.java:79) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination( HttpInboundLink.java:422) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation( HttpInboundLink.java:319) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready( HttpInboundLink.java:288) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters (NewConnectionInitialReadCallback.java:207) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete (NewConnectionInitialReadCallback.java:109) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete( WorkQueueManager.java:537) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO( WorkQueueManager.java:593) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun( WorkQueueManager.java:946) at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run( WorkQueueManager.java:1038) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1446) Caused by: java.util.NoSuchElementException at java.lang.Throwable.init(Throwable.java:180) at java.lang.Exception.init(Exception.java:29) at java.lang.RuntimeException.init(RuntimeException.java:32) at java.util.NoSuchElementException.init(NoSuchElementException.java :28) at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject( GenericKeyedObjectPool.java:760) ... 31 more [18/10/06 11:59:53:253 TUC] 0379 SystemErr R org.apache.ojb.broker.PBFactoryException: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=db2bmce, password=*
Re: removal aware list
I tried to reproduce your test (m:n reference + proxy) without success - I always get a ManageableArrayList instance. I'm using latest from SVN (OJB_1_0_RELEASE branch). Could you exactly describe how to reproduce your problem. regards, Armin While describing i found out that there was another M:N collection that did not specified the collection class. While stepping i thought it was the other, thanks and sorry to have bothered you with this because nothing is wrong. Cheers, Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: removal aware list
Richter, I use 1.04 and explicitly configured ojb not to use a RemovalAwareList. I explicitly configured ojb to use a ManageableArrayList. But still i get a RemovalAwareList out of the proxy class's getData method. regards, Dennis 2006/9/19, Edson Carlos Ericksson Richter [EMAIL PROTECTED]: As name said, it's a Removal Aware. If you don't wish objects removed, don't use RemovarAware. The default implementation is not RemovalAwareList, so it's sufficient to remove the specific implementation on mapping. IT: some older versions of OJB used RemovalAwareList as default - so, please, if you are not using 1.0.3 or 1.0.4, upgrade your version (check mail list about changes that could affect your upgrade). Regards, Richter Dennis Bekkering escreveu: Hello all, I have an M:N collection that has a ManageableArrayList as collection class and proxy set to true. But when the collection is materialized the underlying implementation becomes RemovalAwareList. When i remove items from that list the records are also deleted. I tried to find out how that can happen with the debugger but i cannot find out why. regards, Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
Re: mysql pool problem (again)
Martin, Thanks for the help. As usual i was to fast with conclusions, my problems at the time originated from a connection leak. Thanks, Dennis 2006/8/8, Martin Kalén [EMAIL PROTECTED]: Dennis Bekkering skrev: A validation query doesn't help in the MySQL scenario: The driver will automatically reconnect and successfully execute the query, but the Connection still has a chance of remaining in an inconsistent state. This won't happen on every reconnect, just on some. You are perfectly right that the MySQL JDBC-driver's auto re-connect feature conflicts with the Java connection pool settings, creating this inconsistency. However, I don't agree that a validation query does not help - you should be able to turn off the MySQL-specific feature in the JDBC driver and let the OJB or DBPC connection pool implementations handle re-connect via validation query (and validation query only). To turn off the MySQL re-connect feature: 1. make sure the JDBC URL does *not* include ?autoReconnect=true (the default value is false = off) 2. make sure that the OJB connection pool settings does *not* include the JDBC connection property: attribute attribute-name=jdbc.autoReconnect attribute-value=true/ To make sure that MySQL auto re-connect is off, you can add an explicit false setting in the OJB connection-pool configuration (but do make sure to clean the JDBC URL according to #1 above): connection-pool ... testOnBorrow=true ... validationQuery=... ... attribute attribute-name=jdbc.autoReconnect attribute-value=false/ ... /connection-pool (Although the default setting has been false since MySQL JDBC v1.1) Wouldn't this help in your scenario? See also: *) MySQL documentation: Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-configuration-properties.html *) OJB documentation: Repository File, connection-pool, Custom attributes, jdbc.* http://db.apache.org/ojb/docu/guides/repository.html#jdbc.* Regards, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
java.util.NoSuchElementException after stesstest
Hello, After and while running a stresstest with a tool i get the following error. My code stops at PersistenceBrokerFactory.defaultPersistenceBroker(). I know it is imposible to see what is happening from the trace and that it happens in apache - commons code but maybe somebody has seen this before and might know what is going on. org.apache.ojb.broker.PBFactoryException: Borrow broker from pool failed, using PBKey org.apache.ojb.broker.PBKey: jcdAlias=oracle, user=myvision, password=* at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker (PersistenceBrokerFactoryDefaultImpl.java:120) at org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker (PersistenceBrokerFactoryBaseImpl.java:161) at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker( PersistenceBrokerFactory.java:75) at com.myvision.persistance.orm.ojb.OjbDelegate.currentBroker( OjbDelegate.java:356) at com.myvision.persistance.orm.ojb.OjbDelegate.getFromCache( OjbDelegate.java:62) at com.myvision.business.GenericDelegate.getFromCache( GenericDelegate.java:277) at com.myvision.business.GenericDelegate.getSingleTon( GenericDelegate.java:284) at com.myvision.business.MyVisionSettingsDelegate.getMyVisionSettings( MyVisionSettingsDelegate.java:35) at com.myvision.util.ExceptionUTILS$1.run(ExceptionUTILS.java:30) Caused by: java.util.NoSuchElementException at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject( GenericKeyedObjectPool.java:758) at org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.createPersistenceBroker (PersistenceBrokerFactoryDefaultImpl.java:101) Cheers, Dennis
Re: java.util.NoSuchElementException after stesstest
Hello Armin, If you run stress tests on OJB please make sure that the maximal active PB instances setting and the maximal active connections setting in ConnectionFactory (see repository file connection-pool http://db.apache.org/ojb/docu/guides/repository.html#connection-pool-N10251 ) is higher then the concurrent used PB instances by the stress test. regards, Armin I have *whenExhaustedAction*=2, i thought that it would grow in that case automatically. I suspect myself of having a broker leak but i searched and cannot find it (yet). thanks, Dennis
Re: java.util.NoSuchElementException after stesstest
Armin, You are right. I run a test with latest from SVN (OJB_1_0_RELEASE branch) with whenExhaustedAction=2 and it works as expected. Wrong OJB.properties file in your classpath? regards, Armin I actually dont use OJB.properties but repository-database.xml for pool settings. The OJB.poperties entries regarding pool are commented out but the file is on the class path and works because i can switch the ConnectionFactoryClass and see that it is different. Should i use OJB.properties instead of repository-database.xml? thanks, Dennis
Re: java.util.NoSuchElementException after stesstest
Within the connection-pool element you set the size of the connection-pool, in the OJB.properties file you set the size of the PB-pool (this is not the same). Thus you need both settings. It's obvious that the PB-pool size should always greater or equals to the connection-pool size. regards, Armin tjeeh, i never noticed the difference between broker and connection pool anyway. I checked with the debugger and whenExhaustedAction for brokers is 0 by default so thats why it happened. It is on 2 now and all is fine. thanks again, Dennis
Re: ORA-00932 inconsistent datatypes with CLOB
Hello Steve, What does your criteria code look like? I have the same problem when applying like operation on a CLOB. I therefore changed the fieldtype to varchar2(4000). Cheers, Dennis
Re: mysql pool problem (again)
Hello Armin, I'm confused. How does this happen. OJB always use ConnectionFactory#lookupConnection to lookup connections and doesn't differ between transactional and non-transactional connections, thus the validation query is always performed. The only difference is the lifetime of the connection associated with the used PB instance. With tx the connection will be closed (returned to pool) on PersistenceBroker.commitTransaction() or PersistenceBroker.abortTransaction(). Without running tx the connection only be closed (returned to pool) on PB.close() call. http://db.apache.org/ojb/docu/guides/connection.html#When+does+OJB+open%2Fclose+a+connection You are right i didn't close the broker. I got lazy by the broker per view pattern. But this code was in a scheduler thread and not in an http request so i have to close it after every performed scheduled task. Thank you so much for clearing that out. Cheers, Dennis
Re: mysql pool problem (again)
Hello Tom, Hmm, I'm not too sure why you need this behavior, but I think you should definitely ask the DBCP guys over at the commons-user mailing list. I checked OJB.properties and I am using ConnectionFactoryPooledImpl.class . I kill the connections with the mysql administrator tool, simulating timed out connections. I discovered that the validation query is not called on non transactional requests. Is there a special reason for that? Is it maybe wise to check always when a new broker is called by PersistenceBrokerFactory.defaultPersistenceBroker()? Actually the code where the problem occured needed a transaction so i am happy that i discovered it this way ;-) Cheers, Dennis
mysql pool problem (again)
Hello all, I am experiecing problems with mysql regarding connection time outs again. This problem cannot be resolved by the pool settings provided or jdbc driver settings such as autoReconnect (wich should not be used anyhow). Here is a more detailed explaination about the problem (from tss). I could set wait_timeout on mysql much longer but that is not a solution to the problem. - A new feature that I'd really like to see in DBCP 1.3 is a time-to-live for Connections. In particular with MySQL, such a feature is very helpful, because MySQL Connections can start showing strange behavior when the underlying connection has been terminated and implicitly reconnected. Note that such a setting should not regard whether the connection has been active or idle: After the specified amount of time, it should be closed and removed from the pool in any case. A validation query doesn't help in the MySQL scenario: The driver will automatically reconnect and successfully execute the query, but the Connection still has a chance of remaining in an inconsistent state. This won't happen on every reconnect, just on some. Two connection pools that provide such a time-to-live are Resin's (max-pool-time) and Proxool (maximum-connection-lifetime). We're using the former now for MySQL. Unfortunately, Proxool doesn't provide a bean-style DataSource yet... (but will do so in the upcoming 0.9 release). - My questions are: - can ojb use the above mentioned pool lib's. - does commons pool 1.3 have such a property (i couldn't find it) - can ojb maybe handle this somehow (mysql specific) Cheers, Dennis
oracle id in m:n tables
Hello All, When i add a record to a collection that is of type many 2 many the following sql is executed INSERT INTO m2m_196 (ruleValueListId,ruleValueId) VALUES (?,?) , the id field is not specified in the query but the table has such a field and therefore oracle complains about the fact that the id is not there. I know that i could do without an id field and use a composit id but i rather move on without having to change all my tables. I dont believe i can let oracle asign id's automatically like on mysql. Is there a solution to this problem? Cheers, Dennis
Re: oracle id in m:n tables
Thanks for the link Tom, that information was exactly what i was looking for. 2006/6/19, Thomas Dudziak [EMAIL PROTECTED]: On 6/19/06, Dennis Bekkering [EMAIL PROTECTED] wrote: When i add a record to a collection that is of type many 2 many the following sql is executed INSERT INTO m2m_196 (ruleValueListId,ruleValueId) VALUES (?,?) , the id field is not specified in the query but the table has such a field and therefore oracle complains about the fact that the id is not there. I know that i could do without an id field and use a composit id but i rather move on without having to change all my tables. I dont believe i can let oracle asign id's automatically like on mysql. Is there a solution to this problem? From what I gather Oracle complains about a missing primary key in the table m2m_196, right ? If that's the case, then there are two easy solutions that I can think of: * If the pair (ruleValueListId,ruleValueId) is unique in the table, then you can generate a composite primary key with these two columns. * Otherwise, you should define a sequence and add a new column to the table for the primary key. Something like this: http://www.lifeaftercoffee.com/2006/02/17/how-to-create-auto-increment-columns-in-oracle/ In this case, OJB will not have anything to do with the primary key of the m:n table. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
Re: generate global uid's
Sorry, nope! At the beginning of OJB some people plan to support beside RDBMS and other persistence datastores, but it was too complex to realize with a few OJB committer. Thanks for clearing out, where exactly lies the complexity, the quering i solved my own project. I have the biggest problem with activationdepth, with OJB there isn't such concept (aka lazy loading). Dunno of that is db4objects specific or also SODA. With how many are you working currently on OJB? Cheers, Dennis
Re: generate global uid's
Hi, I found out that the select IN problem had to do with different charsets on the column level, since my id's where varchars this problem occured suddenly , i checked all column charset but couldn't find a difference between them. The deeper i get into mysql the more i find out why not everybody likes this database that much. It is very hard to determine what is wrong and why. What are other developers favorite database either open source or not? Are there databases that have meaningfull error messages anyway? Regarding the GUID's and collections i tried another appraoch then i first suggested. I added an xtra guid field to every table, now tables have a local int id and a global varchar one. I did this to be able to move on but it is better anyway i think. For collections (either 1:N or M:N) i only send the GUID's of the members in that collections. If the new records are send before that then the collections can be assambled thereafter without having to fall back on sql. The cache doesn't have to be cleared also. The last 2 years i tried several approaches but i think this one will actually work. For me It is one of the hardest problems to find a solution for. Anyway i had to browse the OJB source and that was fun, i discovered source files regarding SODA. What is the status of this? I made a conceptual interface implementation for SODA, the same interface that i use to query OJB, but if OJB already supports SODA i would be crazy to build it myself. Can i for instance use db4objects with OJB? Cheers, Dennis 2006/5/13, Dennis Bekkering [EMAIL PROTECTED]: All, I converted all my int id's and refs to varchar id's and ref's, i offcourse updated the repository file also. Now it seems that OJB expects id's to be of type int in 1:N and M:N relations. I get errors regarding select where id IN (?,?,?,?,?). I did not really looked in the source yet at what is happening, so my questioin is if it is at all possible to use varchars in 1:N and M:N relations. I can not post the log because i have the new stuff at home only right now and am at work (on saterday?, yes i am a crazy nerd ;-). If it should be possible i will dive into it deeper and try to find what i am doing wrong. Cheers, Dennis -- mvg, Dennis
Re: generate global uid's
All, I converted all my int id's and refs to varchar id's and ref's, i offcourse updated the repository file also. Now it seems that OJB expects id's to be of type int in 1:N and M:N relations. I get errors regarding select where id IN (?,?,?,?,?). I did not really looked in the source yet at what is happening, so my questioin is if it is at all possible to use varchars in 1:N and M:N relations. I can not post the log because i have the new stuff at home only right now and am at work (on saterday?, yes i am a crazy nerd ;-). If it should be possible i will dive into it deeper and try to find what i am doing wrong. Cheers, Dennis
Re: generate global uid's
Hello all, I am almost there with regards to asynq data merging based upon GUID. What i am looking for now is a way to have a creationdate field in indirectiontables. I am not sure how to do this since it is all handled by OJB. The case is like this, a local server has records that are not present in the main server. It is either a new local record or a deleted global one. I can discover what it is if i know the last synqdate of the localserver. If the lastsynq date is after the creationdate of the local record then the global record is deleted and the local record should also be deleted, if the lastsynq is before the creationdate then the local record is new and should be send to the main server. I can control every record's creationdate except for the indirecttable ones. regards, Dennis 2006/4/25, Armin Waibel [EMAIL PROTECTED]: Hi Dennis, to use OJB's auto-increment feature (automatic assignment of PK's) you have to implement a SequenceManager based on class GUIDFactory. Simply extend AbstractSequenceManager and override public Object getUniqueValue(...) Implement protected int getUniqueId(...) and throw exception within this method (see SequenceManagerMSSQLGuidImpl). regards, Armin Dennis Bekkering wrote: great, thanks! 2006/4/24, Thomas Mahler [EMAIL PROTECTED]: Hi Dennis, org.apache.ojb.broker.util.GUIDFactory produces GUIDs that are unique across different VMs. cheers, Thomas Dennis Bekkering wrote: Hello all, I have a situation where i frequently have to merge data from different databases. Uptill now every database has it's own sequence. That means that i cannot merge the data blindly because two records with the same id might not be the same record. I am thinking of switching from int id's to varchar UID's. Does ojb support such mechanism in an offline manner, so that the two servers do not need to communicate with each other. If all id's are globally unique i can blindly merge data without the danger of overwriting stuff. If ojb does not offer this out of the box then does anybody now a way to generate UID's across systems. Within one system I use java.rmi.server.UID().toString() but i dont know how unique that is across different VM's. Cheers, Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
Re: generate global uid's
great, thanks! 2006/4/24, Thomas Mahler [EMAIL PROTECTED]: Hi Dennis, org.apache.ojb.broker.util.GUIDFactory produces GUIDs that are unique across different VMs. cheers, Thomas Dennis Bekkering wrote: Hello all, I have a situation where i frequently have to merge data from different databases. Uptill now every database has it's own sequence. That means that i cannot merge the data blindly because two records with the same id might not be the same record. I am thinking of switching from int id's to varchar UID's. Does ojb support such mechanism in an offline manner, so that the two servers do not need to communicate with each other. If all id's are globally unique i can blindly merge data without the danger of overwriting stuff. If ojb does not offer this out of the box then does anybody now a way to generate UID's across systems. Within one system I use java.rmi.server.UID().toString() but i dont know how unique that is across different VM's. Cheers, Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
generate global uid's
Hello all, I have a situation where i frequently have to merge data from different databases. Uptill now every database has it's own sequence. That means that i cannot merge the data blindly because two records with the same id might not be the same record. I am thinking of switching from int id's to varchar UID's. Does ojb support such mechanism in an offline manner, so that the two servers do not need to communicate with each other. If all id's are globally unique i can blindly merge data without the danger of overwriting stuff. If ojb does not offer this out of the box then does anybody now a way to generate UID's across systems. Within one system I use java.rmi.server.UID().toString() but i dont know how unique that is across different VM's. Cheers, Dennis
Re: ojb start ?
Hibernate gives (way) more headache because of very unclear error messages. Hibernate does a lot of checking (therefore more unclear error messages) and safes programmers for mistakes more than OJB. Hibernate is session based wich means that your object tree has boundaries outside the session scope. The biggest and most occuring exception is therefore the lazy loading exception. EG fetch a record store it in the http session and in the next http request you cannot work with the record because the hibernate session is closed, you will always have to refresh the record manually. With ojb you dont need to refresh those objects. Some say that is bad because of the risk of outdated data, but i think it is ok when you know how to handle this. The hibernate criteria API is a monster, it is like the java Calendar API, dont get me started;-). With OJB you can add criteria (AND OR) to another criteria. With hibernate you can only add AND conditions to a criteria, you cannot add other criteria to criteria. In that case you have to fall back to HQL, wich is just compact sql, wich we all trying to keep out of our code. OJB is just simpler and a pleasure to work with, with hibernate you are up for a fight, every day again. When you know what you are doing i'd say go OJB, when you are not that sure about yourself go hibernate, it is harder but safer. rg, Dennis 2006/4/18, [EMAIL PROTECTED] [EMAIL PROTECTED]: Hi , I am begining to study o/r mapping as database layer for j2ee application ; so i decide to select between hibernate and ojb . Would you like to give me some information to make my decision thank in advanced, Regards , -- View this message in context: http://www.nabble.com/ojb-start--t1467235.html#a3965408 Sent from the Apache DB - ObjectRelationalBridge Users forum at Nabble.com . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
Re: Spring Transactions
YES you need innoDB, myIsam does not support transactions, i guess you want transactions. regards, Dennis 2006/3/10, Thomas Dudziak [EMAIL PROTECTED]: On 3/9/06, Saman Ghodsian [EMAIL PROTECTED] wrote: I have an implementation of my model with OJB using just PersistenceBroker. Now I'm looking into adding transactional support, looked into ODMG but it seems complex to implement since all my mapping and query is in Broker lingo, so I'm looking at injecting Transaction support for my process methods with spring, that way I shouldn't need to change config files and just one class that interfaces with the Broker. Now, I tried to look for samples outthere found this http://www.springframework.org/node/116 First, you should have a look at the PetStore sample in Spring, which includes OJB support. Also of interest is this: http://staff.osuosl.org/~mckerrj/?p=3. But after setting it up transactions don't seem to be happening. So my questions are. 1- Do I need to use InnoDB on Mysql ? My tables are MyIsam. You should definitely ask this in the Spring forums. Or rather, search the forums - MySql is a commonly used DB so there is bound to be some questions regarding it. 2- Am I missing any other feature besides applicationContext setup and deriving my class from PersistenceBrokerDaoSupport? See the tutorial above. In short, you'll need the LocalDataSourceConnectionFactory that spring provides, in OJB.properties, and you need to declare the transaction wrapping in the applicationContext.xml around your management or DAO objects (management objects are preferred which logically bundle DB accesses provided by one or more DAOs). Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
Re: EJB3 ?
OJB runs outside of a container, it is not really comparable. Also ojb criteria api is way better then anything out there. I like to stay far from things like select object(o) from Book o where lower(o.title) like '%java%'. regards, Dennis 2006/3/6, Hale India [EMAIL PROTECTED]: Hi This mail is just to ask about projects of OJB Team about EJB3. Now specification seems to me completed and stable and some OJB competitors has offer. EJB3 same already to be a standard. This seems to me a critical question about OJB future. Any answer welcome Andre -- mvg, Dennis
Re: Help needed for Transaction Rollbacks
I think OTM is kind of deprecated, but i don't know if it's important for this issue. In my mind when you do a commit a transaction, if something fails, no step of the transaction should have been commited, so maybe your database do not support transactions. I also wonder what the OTM story is. Is it because of the dirty reads? Does the 2nd level cache make the OTM obsolete?
Re: Problem with signed applet.
the applet can propbably not find the repository in it's class path. Try to stuff everything in a jar and use that jar instead of a single class. 2006/2/1, alessandro olivieri [EMAIL PROTECTED]: Hi, I'm using ojb 1.0 rc1 in a signed applet. Without warning, this applet is not working when I try to modify repository.xml. The error message is: [BOOT] ERROR: Error in instantiation of PersistenceBrokerFactory class Could not read repository class descriptor data, using repository: repository.xml: Elemento root del documento mancante. org.xml.sax.SAXParseException: Elemento root del documento mancante. But if I added a main in my java class and I directly call my ojb data function this working fine. Tnx in advance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
Re: OJB_HL_SEQ
I had the same problem and fixed it by removing field-descriptor name=name column=FIELDNAME jdbc-type=VARCHAR primarykey=true / from class-descriptor class=org.apache.ojb.broker.util.sequence.HighLowSequence table=ojb_hl_seq in repository_internal.xml regards, Dennis 2006/1/21, Armin Waibel [EMAIL PROTECTED]: Hi Rick, Rick Roman wrote: After upgrading to ojb-1.0.4 I am getting an error: [org.apache.ojb.broker.metadata.RepositoryXmlHandler] ERROR: Exception while read metadata Error creating PersistentField: org.apache.ojb.broker.util.sequence.HighLowSequence, name org.apache.ojb.broker.metadata.MetadataException: Error creating PersistentField: org.apache.ojb.broker.util.sequence.HighLowSequence, name at org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldFactory.createPersistentField(Unknown Source) at org.apache.ojb.broker.metadata.RepositoryXmlHandler.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) I think I need to do the operation described in the release notes: * Internal used OJB_HL_SEQ table changed. Remove of deprecated column. If the SequenceManagerHighLowImpl was used and problems occur after upgrade, please drop and recreate this table without removed column Where is the table and where is the new definition to recreate it with? Hope this link help: http://db.apache.org/ojb/docu/guides/platforms.html#OJB+internal+tables The concrete sql definition depends on the used DB, e.g. hsql: drop table OJB_HL_SEQ if exists; CREATE TABLE OJB_HL_SEQ ( TABLENAME VARCHAR (250), MAX_KEY BIGINT, GRAB_SIZE integer, VERSION integer, PRIMARY KEY(TABLENAME) ); regards, Armin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: lazy loading 1.0.4
Armin, I looked at it a little better and it is because i have my own cache for model and view objects because they are used so much. I think that I also understand why the initial organisation query only queries the organisation and country table while there are a lot more references. When the reference id 's are null there are no queries. And the parent organisations are in the cache already while fetching all organisations. thanks, Dennis Indeed that's strange! Are you sure that no cache was used in your test (e.g. enable logging for class org.apache.ojb.broker.cache.CacheDistributor and check output)? If yes, it needs detailed analysis. In this case please add a bug report in JIRA with detailed description to reproduce the behavior. regards, Armin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ERROR: Can't lookup new HighLowSequence for field id using sequence name SEQ_appointment
Hi, 1.0.4 seem to be case sensitive or something else is wrong, anyway when I change SEQ_Appointment to SEQ_appointment in the ojb_hl_seq table I still get the error. It will propbably be OK when I restart my server but I like to do that at night and not in the middle of the day. Is there a way to reset the HiLo manager at runtime? thanks, Dennis
Caused by: org.apache.ojb.broker.util.sequence.SequenceManagerException: Can't build new sequence
Hi, In my previous mail I said that it would probably be OK if I restart the server. I made sure there is an entry SEQ_appointment but I still cannot insert records due to this error. Any hints? thanks, Dennis
Re: Caused by: org.apache.ojb.broker.util.sequence.SequenceManagerException: Can't build new sequence
excuse me for doing before reading;). I replaced the repository_internal and it is OK now. Thanks! 2006/1/10, Armin Waibel [EMAIL PROTECTED]: Hi Dennis, Dennis Bekkering wrote: Hi, In my previous mail I said that it would probably be OK if I restart the server. I made sure there is an entry SEQ_appointment but I still cannot insert records due to this error. Any hints? Did you note in release-notes (1.0.4) in section CHANGES that a deprecated column in sequence table was removed? snip * Internal used OJB_HL_SEQ table changed. Remove of deprecated column. If the SequenceManagerHighLowImpl was used and problems occur after upgrade, please drop and recreate this table without removed column /snip Maybe this cause the problem. regards, Armin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
Re: broken pipe?
my driver was and is mysql-connector-java-3.1.5-gamma-bin.jar so I updated to jdbc level 3. Will update to 1.0.3 tonight if lazy is still lazy. 2006/1/9, Thomas Dudziak [EMAIL PROTECTED]: On 1/9/06, Dennis Bekkering [EMAIL PROTECTED] wrote: The whole thing looks like this now, I don't use 1.0.4 though on production. Does the attribute do anything then. It runs on rc7. The custom attribute is new in 1.0.4, so it won't do anyting in older versions. I'd suggest you first update to 1.0.3 (there shouldn't have been too many changes regarding lazy loading) and see how that works. Btw, you should use jdbc level 3 for the mysql driver, and update to the newest driver (3.1), there have been a lot of changes AFAIK. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
Re: lazy loading 1.0.4
Armin, It was the cache setting not the lazy loading.Fast as lightning again ;-) Strange though that without caching the 2nd number of queries is less? thanks, Dennis did you notice that the ObjectCache configuration moved from OJB.properties to repository file between rc7 and 1.0.4? You have to declare the cache within the jdbc-connection-descriptor using a object-cache element. http://db.apache.org/ojb/docu Does that mean that there is no caching at all now? Maybe that's the reason why there are more queries in 1.0.4. The thing is that I get just one query ,no joins, when i select all organisations from rc7 while there are some references that are not interfaces so they cannot be proxies anyway?? When I select 1 organisation I get all reference data with it when I call the getters. Calling all orgs on 1.0.4 I gives outer joins the 2nd time. : SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version ,A0.fax, A0.fieldofinterest,A0.name,A0.noofemployee,A0.phone,A0.postaladress, A0.postalcity,A0.postalzip,A0.url,A0.visitadress,A0.visitcity, A0.visitzip, A0.chamberofcommerceno ,A0.immediateparentid,A0.ultimateparentid, A0.postalcountryid,A0.organisationbrancheid,A0.visitcountryid, A0.organisationtypeid FROM organisation A0 [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl ] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.code, A0.name, A0.number FROM country A0 WHERE A0.id = ? regards, Dennis 2006/1/9, Armin Waibel [EMAIL PROTECTED]: Hi Dennis, if I summarize your posted sql-queries we will get 1.0.4: FROM organisation A0 FROM country A0 WHERE A0.id = ? FROM tablemodel A0 WHERE A0.name = ? FROM field A0 WHERE A0.id = ? FROM fieldtype A0 WHERE A0.id = ? FROM reference A0 WHERE A0.parenttablemodelid = ? FROM rendertype A0 WHERE A0.id = ? FROM tablemodel A0 WHERE A0.id IN (?,?,?,?) FROM field A0 WHERE A0.id IN (?,?) FROM fieldtype A0 WHERE A0.id = ? FROM field A0 WHERE A0.parenttablemodelid = ? FROM fieldtype A0 WHERE A0.id IN (?,?,?) FROM tablemodel A0 WHERE A0.id = ? rc7: FROM organisation A0 FROM country A0 WHERE A0.id = ? FROM tablemodel A0 WHERE A0.name = ? FROM field A0 WHERE A0.parenttablemodelid = ? FROM fieldtype A0 WHERE A0.id IN (?,?) FROM reference A0 WHERE A0.parenttablemodelid = ? Seems that lazy loading works, because there is no query for the m:n and 1:n references. Think the other queries are the result of the 1:1 references and additional queries if the referenced object has references too or some prefetching stuff. If this is the case you could try to enable lazy loading for some 1:1 references too and check the generated queries again. you post ProxyFactoryClass=org.apache.ojb.broker.core.proxy.ProxyFactoryCGLIBImpl ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl did you notice that the ObjectCache configuration moved from OJB.properties to repository file between rc7 and 1.0.4? You have to declare the cache within the jdbc-connection-descriptor using a object-cache element. http://db.apache.org/ojb/docu/guides/objectcache.html regards, Armin Dennis Bekkering wrote: Hello, I recently switched from rc7 to 1.0.4 and lazy loading seem to happen any more. Can someone please check my config out. 1.0.4 fires twice as much queries? thanks. sql output get all organisations 1.0.4 just after clear cache [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.fax, A0.fieldofinterest, A0.name,A0.noofemployee,A0.phone,A0.postaladress, A0.postalcity,A0.postalzip,A0.url,A0.visitadress,A0.visitcity, A0.visitzip, A0.chamberofcommerceno,A0.immediateparentid,A0.ultimateparentid, A0.postalcountryid ,A0.organisationbrancheid,A0.visitcountryid, A0.organisationtypeid FROM organisation A0 [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id ,A0.lastmodified,A0.creationdate,A0.version,A0.code, A0.name, A0.number FROM country A0 WHERE A0.id = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl ] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version, A0.defaultvalue, A0.fixheader,A0.groupby,A0.indescriptor,A0.name,A0.subtablesheight , A0.descriptorfieldid,A0.defaultqueryid,A0.quicksearchqueryid FROM tablemodel A0 WHERE A0.name = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version, A0.defaultvalue, A0.indescriptor,A0.name,A0.ordr,A0.showintable,A0.sortdown, A0.fieldtypeid , A0.fieldcollectionid,A0.parenttablemodelid,A0.calculatedfieldid FROM field A0 WHERE A0.id = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.name, A0.typeFROM fieldtype A0 WHERE A0.id
Re: broken pipe?
everything is on 1.0.4 now. I also updated all my other libraries with the latest. The jdbc level is 3, lets wait and see. If it still fails I will have to modify the pool class(es) I guess. 2006/1/9, Dennis Bekkering [EMAIL PROTECTED]: my driver was and is mysql-connector-java-3.1.5-gamma-bin.jar so I updated to jdbc level 3. Will update to 1.0.3 tonight if lazy is still lazy. 2006/1/9, Thomas Dudziak [EMAIL PROTECTED]: On 1/9/06, Dennis Bekkering [EMAIL PROTECTED] wrote: The whole thing looks like this now, I don't use 1.0.4 though on production. Does the attribute do anything then. It runs on rc7. The custom attribute is new in 1.0.4, so it won't do anyting in older versions. I'd suggest you first update to 1.0.3 (there shouldn't have been too many changes regarding lazy loading) and see how that works. Btw, you should use jdbc level 3 for the mysql driver, and update to the newest driver (3.1), there have been a lot of changes AFAIK. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis -- mvg, Dennis
lazy loading 1.0.4
Hello, I recently switched from rc7 to 1.0.4 and lazy loading seem to happen any more. Can someone please check my config out. 1.0.4 fires twice as much queries? thanks. sql output get all organisations 1.0.4 just after clear cache [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.fax, A0.fieldofinterest,A0.name,A0.noofemployee,A0.phone,A0.postaladress, A0.postalcity,A0.postalzip,A0.url,A0.visitadress,A0.visitcity,A0.visitzip, A0.chamberofcommerceno,A0.immediateparentid,A0.ultimateparentid, A0.postalcountryid,A0.organisationbrancheid,A0.visitcountryid, A0.organisationtypeid FROM organisation A0 [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.code,A0.name, A0.number FROM country A0 WHERE A0.id = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.defaultvalue, A0.fixheader,A0.groupby,A0.indescriptor,A0.name,A0.subtablesheight, A0.descriptorfieldid,A0.defaultqueryid,A0.quicksearchqueryid FROM tablemodel A0 WHERE A0.name = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.defaultvalue, A0.indescriptor,A0.name,A0.ordr,A0.showintable,A0.sortdown,A0.fieldtypeid, A0.fieldcollectionid,A0.parenttablemodelid,A0.calculatedfieldid FROM field A0 WHERE A0.id = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.name,A0.typeFROM fieldtype A0 WHERE A0.id = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.defaultvalue, A0.name,A0.ordr,A0.property,A0.selectionpath,A0.showintable, A0.parentcollectionmodelid,A0.innerselectid,A0.parenttablemodelid, A0.rendertypeid,A0.entityid FROM reference A0 WHERE A0.parenttablemodelid = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.name, A0.referenceid FROM rendertype A0 WHERE A0.id = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.defaultvalue, A0.fixheader,A0.groupby,A0.indescriptor,A0.name,A0.subtablesheight, A0.descriptorfieldid,A0.defaultqueryid,A0.quicksearchqueryid FROM tablemodel A0 WHERE A0.id IN (?,?,?,?) [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.defaultvalue, A0.indescriptor,A0.name,A0.ordr,A0.showintable,A0.sortdown,A0.fieldtypeid, A0.fieldcollectionid,A0.parenttablemodelid,A0.calculatedfieldid FROM field A0 WHERE A0.id IN (?,?) [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.name,A0.typeFROM fieldtype A0 WHERE A0.id = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.defaultvalue, A0.indescriptor,A0.name,A0.ordr,A0.showintable,A0.sortdown,A0.fieldtypeid, A0.fieldcollectionid,A0.parenttablemodelid,A0.calculatedfieldid FROM field A0 WHERE A0.parenttablemodelid = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.name,A0.typeFROM fieldtype A0 WHERE A0.id IN (?,?,?) [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.defaultvalue, A0.fixheader,A0.groupby,A0.indescriptor,A0.name,A0.subtablesheight, A0.descriptorfieldid,A0.defaultqueryid,A0.quicksearchqueryid FROM tablemodel A0 WHERE A0.id = ? second time [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.fax, A0.fieldofinterest,A0.name,A0.noofemployee,A0.phone,A0.postaladress, A0.postalcity,A0.postalzip,A0.url,A0.visitadress,A0.visitcity,A0.visitzip, A0.chamberofcommerceno,A0.immediateparentid,A0.ultimateparentid, A0.postalcountryid,A0.organisationbrancheid,A0.visitcountryid, A0.organisationtypeid FROM organisation A0 [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.id,A0.lastmodified,A0.creationdate,A0.version,A0.code,A0.name, A0.number FROM country A0 WHERE A0.id = ? sql output get all organisations rc7 just after clear cache [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.organisationbrancheid,A0.ultimateparentid,A0.phone, A0.immediateparentid,A0.visitcountryid,A0.visitzip,A0.postalzip,A0.visitcity ,A0.visitadress,A0.postaladress,A0.fax,A0.id,A0.version,A0.postalcountryid, A0.postalcity,A0.chamberofcommerceno,A0.organisationtypeid,A0.url,
Re: broken pipe?
I asked my provider and they didn't change anything. They pointed out the possible absence of autoReconnect=true in my JDBC url. Does anybody knows if that might help. I'd rather have that than a ping query for every call. Thanks, Dennis 2006/1/4, Dennis Bekkering [EMAIL PROTECTED]: Thomas, I'v been using OJB for years now and it is the first time that I get it. Maybe my provider changed something, i will check that out. My descriptor looks like this for quite a while now :
Re: broken pipe?
i added testOnBorrow=true validationQuery=SELECT 1 to the descriptor, I'l wait and see what happens. Dennis 2006/1/5, Thomas Dudziak [EMAIL PROTECTED]: On 1/5/06, Dennis Bekkering [EMAIL PROTECTED] wrote: I asked my provider and they didn't change anything. They pointed out the possible absence of autoReconnect=true in my JDBC url. Does anybody knows if that might help. I'd rather have that than a ping query for every call. Hmm, autoReconnect = true might be ignored by the MySql driver when autoCommit is set to false for a transaction (e.g. http://lists.mysql.com/java/4928). This might be the case as the OJB doc for 1.0.4 suggests for your setting of useAutoCommit = 1: http://db.apache.org/ojb/docu/guides/repository.html#Attributes-N10127 You could try to set the custom attribute initializationCheck to true (as the above link suggests). Btw, I think (though I'm not sure) that the validation query is only used when a connection is retrieved from the connection pool. You could configrue one and check with P6Spy. Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- mvg, Dennis
Re: broken pipe?
Thomas, I'v been using OJB for years now and it is the first time that I get it. Maybe my provider changed something, i will check that out. My descriptor looks like this for quite a while now : !-- this connection was used as the default one within OJB -- jdbc-connection-descriptor jcd-alias=databaseMySQL default-connection=true platform=MySQL jdbc-level=2.0 driver=com.mysql.jdbc.Driver protocol=jdbc subprotocol=mysql dbalias=//localhost/*** username=root password=root eager-release=false batch-mode=false useAutoCommit=1 ignoreAutoCommitExceptions=false connection-pool maxActive=21 minEvictableIdleTimeMillis=360 numTestsPerEvictionRun=21 testWhileIdle=true timeBetweenEvictionRunsMillis=360 whenExhaustedAction=2 / sequence-manager className= org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl attribute attribute-name=grabSize attribute-value=20/ attribute attribute-name=autoNaming attribute-value=true/ attribute attribute-name=globalSequenceId attribute-value=false/ attribute attribute-name=globalSequenceStart attribute-value=1/ /sequence-manager /jdbc-connection-descriptor
otm transactions
Hello, I don't understand the following, how those the kit know if the connection already is in a transaction? public Iterator moreRealisticQueryByCriteria(Query query, int lock) { OTMKit kit = SimpleKit.getInstance(); OTMConnection conn = null; Transaction tx = null; try { conn = kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey()); tx = kit.getTransaction(conn); boolean auto = ! tx.isInProgress(); if (auto) tx.begin(); Iterator results = conn.getIteratorByQuery(query, lock); if (auto) tx.commit(); return results; } finally { conn.close(); } } mvg, Dennis
Re: OJB/JSP app: how to structure it?
You most certainly don't want to code business functionality right into the JSP. Your project sounds like it would benefit from the Struts framework, have a look here: http://jakarta.apache.org/struts/ and here for a tutorial: http://www.fawcette.com/javapro/2002_07/online/kjones/ Also, there a few people here on the user mailing list that use OJB with Struts, so if you decide to use it, you will most certainly get your questions answered here :-) Tom Paolo, If you decide to go with struts then a tool that i recently released on sourceforge might speed up your development. I haven't had any feedback on it yet so let me know if it is of any help if you choose to try it. project page is http://sourceforge.net/projects/or-mvc-gui/ greetings, Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
a lot of delete statements on insert m:n rc7
Hello, I have a simple unit test class : public static String id; public AppointmentDelegateTest(String arg0) throws Exception { super(arg0); Appointment appointment = new Appointment(); User user = new User(); appointment.setUser(user); appointment.setCreationDate( new java.util.Date() ); appointment.put(); GenericDelegate.getInstance().clearCache(); id = appointment.getId().toString(); } PersistenceBroker broker ; protected void setUp() throws Exception { super.setUp(); try{ broker = PersistenceBrokerFactory.defaultPersistenceBroker(); } catch (PBFactoryException e) { } protected void tearDown() throws Exception { super.tearDown(); broker.close(); } public void testGetAppointment() throws Exception { Criteria criteria = new Criteria(); criteria.addEqualTo(id, new Integer(id)); Query q = QueryFactory.newQuery( Appointment.class , criteria); Appointment appointment = (Appointment) broker.getObjectByQuery(q); assertNotNull( appointment ); } --- the sql debug output = - [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:INSERT INTO Appointment (longdescription,noofattachement,shortdescription,userid,totime,fromtime,id, creationdate,location) VALUES (?,?,?,?,?,?,?,?,?) [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? ...[org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.userid,A0.longdescription,A0.totime,A0.fromtime,A0.location,A0.noofattach ement,A0.creationdate,A0.id,A0.shortdescription FROM Appointment A0 WHERE A0.id = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT password,logname,usercontactid,id FROM User WHERE id = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.gender,A0.phone,A0.mailheader,A0.title,A0.type,A0.function,A0.privat,A0.m ailfooter,A0.id,A0.mobilephone,A0.companyid,A0.lastname,A0.userid,A0.middlen ame,A0.searchname,A0.firstname,A0.online,A0.dateofbirth,A0.initials,A0.email ,A0.creationdate FROM Contact A0,Appointment2Contact WHERE (Appointment2Contact.appointmentId = ?) AND Appointment2Contact.contactId = A0.id
Re: a lot of delete statements on insert m:n rc7
there i am again , setting collection-class=managableList solved all the deleteting so forget about my question please. I still see Result of getTableAlias(): null though , what does it mean? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:INSERT INTO Appointment (longdescription,noofattachement,shortdescription,userid,totime,fromtime,id, creationdate,location) VALUES (?,?,?,?,?,?,?,?,?) [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.userid,A0.longdescription,A0.totime,A0.fromtime,A0.location,A0.noofattach ement,A0.creationdate,A0.id,A0.shortdescription FROM Appointment A0 WHERE A0.id = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT password,logname,usercontactid,id FROM User WHERE id = ? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.gender,A0.phone,A0.mailheader,A0.title,A0.type,A0.function,A0.privat,A0.m ailfooter,A0.id,A0.mobilephone,A0.companyid,A0.lastname,A0.userid,A0.middlen ame,A0.searchname,A0.firstname,A0.online,A0.dateofbirth,A0.initials,A0.email ,A0.creationdate FROM Contact A0,Appointment2Contact WHERE (Appointment2Contact.appointmentId = ?) AND Appointment2Contact.contactId = A0.id [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: Result of getTableAlias(): null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:SELECT A0.originalfilename,A0.filename,A0.id FROM Attachement A0,Appointment2Attachement WHERE (Appointment2Attachement.appointmentid = ?) AND Appointment2Attachement.attachementId = A0.id Time: 0,591 OK (1 test) gr, Dennis - Original Message - From: dennis bekkering [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Tuesday, June 15, 2004 4:05 AM Subject: a lot of delete statements on insert m:n rc7 Hello, I have a simple unit test class : public static String id; public AppointmentDelegateTest(String arg0) throws Exception { super(arg0); Appointment appointment = new Appointment(); User user = new User(); appointment.setUser(user); appointment.setCreationDate( new java.util.Date() ); appointment.put(); GenericDelegate.getInstance().clearCache(); id = appointment.getId().toString(); } PersistenceBroker broker ; protected void setUp() throws Exception { super.setUp(); try{ broker = PersistenceBrokerFactory.defaultPersistenceBroker(); } catch (PBFactoryException e) { } protected void tearDown() throws Exception { super.tearDown(); broker.close(); } public void testGetAppointment() throws Exception { Criteria criteria = new Criteria(); criteria.addEqualTo(id, new Integer(id)); Query q = QueryFactory.newQuery( Appointment.class , criteria); Appointment appointment = (Appointment) broker.getObjectByQuery(q); assertNotNull( appointment ); } --- the sql debug output = - [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:INSERT INTO Appointment (longdescription,noofattachement,shortdescription,userid,totime,fromtime,id, creationdate,location) VALUES (?,?,?,?,?,?,?,?,?) [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement WHERE appointmentid=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Contact WHERE appointmentId=? [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL:DELETE FROM Appointment2Attachement
Re: joining
Jakob, Thank you for your reacttion. The Contact descriptor = class-descriptor class=nl.salesmakers.model.Contact table=Contact field-descriptor id=30 name=dateOfBirth column=dateofbirth jdbc-type=DATE/ field-descriptor id=31 name=email column=email jdbc-type=VARCHAR/ field-descriptor id=32 name=gender column=gender jdbc-type=VARCHAR/ field-descriptor id=33 name=mobilePhone column=mobilephone jdbc-type=VARCHAR/ field-descriptor id=34 name=firstName column=firstname jdbc-type=VARCHAR/ field-descriptor id=35 name=title column=title jdbc-type=VARCHAR/ field-descriptor id=35 name=type column=type jdbc-type=VARCHAR/ field-descriptor id=36 name=companyId column=companyid jdbc-type=INTEGER/ field-descriptor id=37 name=function column=function jdbc-type=VARCHAR/ field-descriptor id=39 name=middleName column=middlename jdbc-type=VARCHAR/ field-descriptor id=40 name=initials column=initials jdbc-type=VARCHAR/ field-descriptor id=41 name=phone column=phone jdbc-type=VARCHAR/ field-descriptor id=42 name=id column=id jdbc-type=INTEGER primarykey=true autoincrement=true/ field-descriptor id=43 name=lastName column=lastname jdbc-type=VARCHAR/ field-descriptor id=44 name=creationDate column=creationdate jdbc-type=DATE/ field-descriptor id=45 name=searchName column=searchname jdbc-type=VARCHAR/ field-descriptor id=46 name=privat column=privat jdbc-type=VARCHAR/ field-descriptor id=47 name=userId column=userid jdbc-type=INTEGER/ field-descriptor id=48 name=mailFooter column=mailfooter jdbc-type=VARCHAR/ field-descriptor id=49 name=mailHeader column=mailheader jdbc-type=VARCHAR/ reference-descriptor name=user class-ref=nl.salesmakers.model.User foreignkey field-ref=userId/ /reference-descriptor reference-descriptor name=company class-ref=nl.salesmakers.model.Company foreignkey field-ref=companyId/ /reference-descriptor field-descriptor name=online column=online jdbc-type=INTEGER/ /class-descriptor Dennis - Original Message - From: Jakob Braeuchi [EMAIL PROTECTED] To: OJB Users List [EMAIL PROTECTED] Sent: Wednesday, June 09, 2004 9:39 PM Subject: Re: joining hi dennis, how does the classdescriptor for Contact look ? jakob dennis bekkering wrote: Hello, I have class Mail with some collections that return contacts. public class Mail { private Collection attachementList = new ArrayList(); private Collection bccList = new ArrayList(); private Collection ccList = new ArrayList(); private Collection toList = new ArrayList(); } descriptor : collection-descriptor name=toList element-class-ref=nl.salesmakers.model.Contact auto-retrieve=true auto-update=true auto-delete=false indirection-table=MailTo2Contact fk-pointing-to-this-class column=mailid/ fk-pointing-to-element-class column=contactId/ /collection-descriptor collection-descriptor name=ccList element-class-ref=nl.salesmakers.model.Contact auto-retrieve=true auto-update=true auto-delete=false indirection-table=MailCc2Contact fk-pointing-to-this-class column=mailid/ fk-pointing-to-element-class column=contactId/ /collection-descriptor collection-descriptor name=bccList element-class-ref=nl.salesmakers.model.Contact auto-retrieve=true auto-update=true auto-delete=false indirection-table=MailBcc2Contact fk-pointing-to-this-class column=mailid/ fk-pointing-to-element-class column=contactId/ /collection-descriptor My sql query for getting all mail messages send to a certain contact : SELECT distinct m.* + FROM + Mail m , + Contact c , + MailTo2Contact mtc , + MailCc2Contact mcc , + MailBcc2Contact mbc + WHERE + (( m.id = mtc.mailid + AND + c.id = mtc.contactid ) + OR + (m.id = mcc.mailid + AND + c.id = mcc.contactid ) + OR + (m.id = mbc.mailid + AND + mbc.contactid = c.id )) + AND + c.id = + contact.getId() + AND + m.flag = 'sent' + order by m.date desc+ ; I offcourse would like to use the pb API but dont know how. Any hints? I cannot use select in , since mysql 4.0 does not support them and 4.1 is not in production. regards, Dennis - 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]
transaction spanning multiple methods
Hello, I have a general question about use of transactions , i am not really confidend in this area. I have delegate classes to store and get objects from the database. eg ContactDelegate.storeContact() and MailDelegate.storeMail() and so on ... I like to reuse those methods and dont want to write a method for every possible storing sequence.In a certain case i like to store the contact only if the mail was stored without any problems. In an other case i just like to store the mail. I cannot begin the transaction in the methods because it would not be one transaction if i call the methods one after the other. I have got the feeling that i 'am asking a really stupid question but i have got a hard time finding a good solution for my need. regards, Dennis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]