Re: Implementing Single Table Aggregation in OJB
Lynn Monson schrieb: Could anyone tell me how to implement the Single Table Aggregation pattern for a 1:1 relation using OJB? RowReaders seem to solve the problem for reading, but I'm stumped as to how to write to such a table. The pattern is found here: http://www.objectarchitects.de/ObjectArchitects/orpatterns/MappingObjects2Tables/SingleTableAggregation/ Any help is *greatly* appreciated. Hello Lynn, can you describe your object-model -respectively the part you want to use the Single Table Aggregation pattern? Joerg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please help: argument type mismatch at PersistenceBroker.getCollectionByQuery()
Ok, my class works, after change JDBC-TYPE from FLOAT to REAL. I will take care of these type mapping. Thank you. On Friday 14 March 2003 16:17, Thomas Mahler wrote: > JDBC FOLAT mapps to Java "double", not to Java "float" ! > > See: http://db.apache.org/ojb/jdbc-types.html -- shivaken ant command line front end antshell http://members.jcom.home.ne.jp/shivaken/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Transactional isolation at the object layer
Beautiful, thanks. I'm loving OJB so far. -Original Message- From: Thomas Mahler [mailto:[EMAIL PROTECTED] Sent: Friday, March 14, 2003 1:15 AM To: OJB Users List Subject: Re: Transactional isolation at the object layer Hi Lance, By default OJB uses one large global cache. To achieve proper isolation you have to tell OJB to use one cache per Broker: In OJB.properties you have to configure to use org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl as objectcache implementation cheers, Thomas Lance Eason wrote: > I'm using 1.0 rc1 with the PB API. I'm noticing that I don't have any isolation > between multiple brokers when caching is enabled. For example: > > Object[] pk = new Object[] {new Long(42)}; > Identity id = new Identity(Article.class, pk); > > PersistenceBroker broker1 = PersistenceBrokerFactory.defaultPersistenceBroker(); > broker.beginTransaction(); > > Article a1 = (Article) broker.getObjectByQuery(new QueryByIdentity(id)); > a1.articleName = "My article"; > > // start a second transaction > PersistenceBroker broker2 = PersistenceBrokerFactory.defaultPersistenceBroker(); > broker2.beginTransaction(); > > Article a2 = (Article) broker.getObjectByQuery(new QueryByIdentity(id)); > // a2 is another reference to the same Article as a1 > a2.unit = "kg"; > > broker2.abortTransaction(); > > broker.store(a1, ObjectModificationDefaultImpl.UPDATE); > broker.commitTransaction(); > > broker2.close(); > broker.close(); > > The changes that I made on the aborted broker2 transaction end up getting persisted > on the broker1 transaction because they're sharing the same object reference. > Similarly changes made on other transactions are visible even before they're > committed. In general it doesn't look like I have any transactional isolation if > caching is turned on. I guess my gut expectation was that caches would be broker > specific and there would be communication between caches to coordinate invalidations > on updates and deletes. > > So how do other people deal with this? I had thought maybe I could manage two > jdbc-connection-descriptors pointing to the same database, one with a cache used > only for reads and another with caching turned off used for updates but it looks > like the caching policy is global not on a per descriptor basis. Am I missing > something obvious? > - 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: Please help: argument type mismatch at PersistenceBroker.getCollectionByQuery()
JDBC FOLAT mapps to Java "double", not to Java "float" ! See: http://db.apache.org/ojb/jdbc-types.html shivaken wrote: With a float, PersistenceBroker.getCollectionByQuery() throws MetaDataException Accouding to stack trace, The error's reason is treating value as double instead of float when invoking setFee(float fee). I wonder that is from wrong configuration. Then I made a test with a very similar object. But test runs. So I can't understand what is happening. If you have some idea, please tell me. This is from my repository_user.xml name="fee" column="FEE" jdbc-type="FLOAT" /> Here is stack trace. Running jp.co.bell24.crps.AllTests [DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], java.lang.IllegalArgumentException [DEFAULT] ERROR: Declaring class [MyClass] [DEFAULT] ERROR: Property Name [fee] [DEFAULT] ERROR: Property Type [float] [DEFAULT] ERROR: anObject was class [MyClass] [DEFAULT] ERROR: aValue was class [java.lang.Double] [org.apache.ojb.broker.accesslayer.RsIterator] ERROR: Unable to build object instance (MAYBE you don't have a constructor available):class MyClass: Error invoking method:setFee in object:MyClass: argument type mismatch java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(PersistentFieldPropertyImpl.java:113) at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.buildWithReflection(RowReaderDefaultImpl.java:239) at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectFrom(RowReaderDefaultImpl.java:119) at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:403) at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:234) at org.apache.ojb.broker.accesslayer.ChainingIterator.next(ChainingIterator.java:357) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1281) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1407) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1453) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1440) at org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:305) at jp.co.bell24.crps.Service.getCalls(Service.java:194) at jp.co.bell24.crps.ServiceTest.testGetCalls(ServiceTest.java:131) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:804) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:551) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:527) at org.apache.tools.ant.Task.perform(Task.java:319) at org.apache.tools.ant.Target.execute(Target.java:309) at org.apache.tools.ant.Target.performTasks(Target.java:336) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.Project.executeTargets(Project.java:1250) at org.apache.tools.ant.Main.runBuild(Main.java:610) at org.apache.tools.ant.Main.start(Main.java:196) at org.apache.tools.ant.Main.main(Main.java:235) rethrown as org.apache.ojb.broker.metadata.MetadataException: Error invoking method:setFee in object:MyClass: argument type mismatch at org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(PersistentFieldPropertyImpl.java:119) at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.buildWithReflection(RowReaderDefaultImpl.java:239) at org.apache.ojb.broker.accesslayer.RowR
Re: Transactional isolation at the object layer
Hi Lance, By default OJB uses one large global cache. To achieve proper isolation you have to tell OJB to use one cache per Broker: In OJB.properties you have to configure to use org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl as objectcache implementation cheers, Thomas Lance Eason wrote: I'm using 1.0 rc1 with the PB API. I'm noticing that I don't have any isolation between multiple brokers when caching is enabled. For example: Object[] pk = new Object[] {new Long(42)}; Identity id = new Identity(Article.class, pk); PersistenceBroker broker1 = PersistenceBrokerFactory.defaultPersistenceBroker(); broker.beginTransaction(); Article a1 = (Article) broker.getObjectByQuery(new QueryByIdentity(id)); a1.articleName = "My article"; // start a second transaction PersistenceBroker broker2 = PersistenceBrokerFactory.defaultPersistenceBroker(); broker2.beginTransaction(); Article a2 = (Article) broker.getObjectByQuery(new QueryByIdentity(id)); // a2 is another reference to the same Article as a1 a2.unit = "kg"; broker2.abortTransaction(); broker.store(a1, ObjectModificationDefaultImpl.UPDATE); broker.commitTransaction(); broker2.close(); broker.close(); The changes that I made on the aborted broker2 transaction end up getting persisted on the broker1 transaction because they're sharing the same object reference. Similarly changes made on other transactions are visible even before they're committed. In general it doesn't look like I have any transactional isolation if caching is turned on. I guess my gut expectation was that caches would be broker specific and there would be communication between caches to coordinate invalidations on updates and deletes. So how do other people deal with this? I had thought maybe I could manage two jdbc-connection-descriptors pointing to the same database, one with a cache used only for reads and another with caching turned off used for updates but it looks like the caching policy is global not on a per descriptor basis. Am I missing something obvious? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Implementing Single Table Aggregation in OJB
Hi Lynn, You have to tell OJB to use a PersistenField implementation supporting this in OJB.properties first, as it is not yet implemented in the default implementation: PersistentFieldClass=org.apache.ojb.broker.metadata.fieldaccess.PersistentNestedFieldMaxPerformanceImpl if your class has an attribute "address" of type Adress, the mapping for the "street" attribute of "address" would look like follows: cheers, Thomas Lynn Monson wrote: Could anyone tell me how to implement the Single Table Aggregation pattern for a 1:1 relation using OJB? RowReaders seem to solve the problem for reading, but I'm stumped as to how to write to such a table. The pattern is found here: http://www.objectarchitects.de/ObjectArchitects/orpatterns/MappingObjects2Tables/SingleTableAggregation/ Any help is *greatly* appreciated. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Please help: argument type mismatch at PersistenceBroker.getCollectionByQuery()
With a float, PersistenceBroker.getCollectionByQuery() throws MetaDataException Accouding to stack trace, The error's reason is treating value as double instead of float when invoking setFee(float fee). I wonder that is from wrong configuration. Then I made a test with a very similar object. But test runs. So I can't understand what is happening. If you have some idea, please tell me. This is from my repository_user.xml Here is stack trace. Running jp.co.bell24.crps.AllTests [DEFAULT] ERROR: Error in [PersistentFieldPropertyImpl], java.lang.IllegalArgumentException [DEFAULT] ERROR: Declaring class [MyClass] [DEFAULT] ERROR: Property Name [fee] [DEFAULT] ERROR: Property Type [float] [DEFAULT] ERROR: anObject was class [MyClass] [DEFAULT] ERROR: aValue was class [java.lang.Double] [org.apache.ojb.broker.accesslayer.RsIterator] ERROR: Unable to build object instance (MAYBE you don't have a constructor available):class MyClass: Error invoking method:setFee in object:MyClass: argument type mismatch java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(PersistentFieldPropertyImpl.java:113) at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.buildWithReflection(RowReaderDefaultImpl.java:239) at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectFrom(RowReaderDefaultImpl.java:119) at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:403) at org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:234) at org.apache.ojb.broker.accesslayer.ChainingIterator.next(ChainingIterator.java:357) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1281) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1407) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1453) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:1440) at org.apache.ojb.broker.singlevm.DelegatingPersistenceBroker.getCollectionByQuery(DelegatingPersistenceBroker.java:305) at jp.co.bell24.crps.Service.getCalls(Service.java:194) at jp.co.bell24.crps.ServiceTest.testGetCalls(ServiceTest.java:131) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:804) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:551) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:527) at org.apache.tools.ant.Task.perform(Task.java:319) at org.apache.tools.ant.Target.execute(Target.java:309) at org.apache.tools.ant.Target.performTasks(Target.java:336) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.Project.executeTargets(Project.java:1250) at org.apache.tools.ant.Main.runBuild(Main.java:610) at org.apache.tools.ant.Main.start(Main.java:196) at org.apache.tools.ant.Main.main(Main.java:235) rethrown as org.apache.ojb.broker.metadata.MetadataException: Error invoking method:setFee in object:MyClass: argument type mismatch at org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldPropertyImpl.set(PersistentFieldPropertyImpl.java:119) at org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.buildWithRefle
Re: OJB 0.9.9 and Oracle 817 always rollback
Hi, I tried 0.9.8, but it doesn't work as well! Running Jetty: - Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true - Initializing, config='org.apache.struts.action.ActionResources', returnNull=true - Initializing, config='com.entersys.escds.webapp.ApplicationResources', returnNull=true [DEFAULT] INFO: OJB Descriptor Repository: file:/opt/jetty/esf/webapps/escds/WEB-INF/classes/repository.xml [DEFAULT] INFO: ...Finished parsing. Took 252 msecs [DEFAULT] INFO: OJB Descriptor Repository: file:/opt/jetty/esf/webapps/escds/WEB-INF/classes/repository.xml [DEFAULT] INFO: ...Finished parsing. Took 92 msecs [DEFAULT] INFO: OJB Descriptor Repository: file:/opt/jetty/esf/webapps/escds/WEB-INF/classes/repository.xml [DEFAULT] INFO: ...Finished parsing. Took 90 msecs [org.apache.ojb.broker.util.sequence.SequenceManagerFactory] INFO: Use sequence manager class: class org.apache.ojb.broker.util.sequence.SequenceManagerHiLoImpl [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Create connection pool for JdbcDescriptorKey 1855968610 [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Create new connection pool for org.apache.ojb.broker.metadata.JdbcConnectionDescriptor, used descriptor: JdbcConnectionDescriptor DBMS:Oracle DRIVER: oracle.jdbc.driver.OracleDriver PROTOCOL: jdbc SUBPROTOCOL: oracle DBALIAS: thin:@localhost:1521:sid USERNAME: esf PASSWORD: pwd EAGER RELEASE: false pool configuration was: {whenExhaustedAction=0, maxIdle=-1, maxActive=10, maxWait=5000, numTestsPerEvictionRun=10, testWhileIdle=false, testOnReturn=false, timeBetweenEvictionRunsMillis=-1, minEvictableIdleIimeMillis=60, testOnBorrow=true} [2003-03-14 13:10:15,990 LV: INFO CL:jcrontab] org.jcrontab.data.DataNotFoundException: No CrontabEntries available [org.apache.ojb.broker.accesslayer.ConnectionManager] INFO: Rollback was called, do rollback on current connection [EMAIL PROTECTED] [org.apache.ojb.broker.accesslayer.ConnectionManager] INFO: Rollback was called, do rollback on current connection [EMAIL PROTECTED] [org.apache.ojb.broker.accesslayer.ConnectionManager] INFO: Rollback was called, do rollback on current connection [EMAIL PROTECTED] [org.apache.ojb.broker.accesslayer.ConnectionManager] INFO: Rollback was called, do rollback on current connection [EMAIL PROTECTED] [org.apache.ojb.broker.accesslayer.ConnectionManager] ERROR: Rollback on the underlying connection failed Io exception: Bad file descriptor java.sql.SQLException: Io exception: Bad file descriptor at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:324) at oracle.jdbc.driver.OracleConnection.rollback(OracleConnection.java:889) at org.apache.ojb.broker.accesslayer.ConnectionManager.localRollback(Unknown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.abortTransaction(Unknow n Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.close(Unknown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.finalize(Unknown Source) at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method) at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:86) at java.lang.ref.Finalizer.access$100(Finalizer.java:17) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:163) [org.apache.ojb.broker.platforms.PlatformDefaultImpl] ERROR: Set autoCommit(true) failed Io exception: Bad file descriptor java.sql.SQLException: Io exception: Bad file descriptor at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:324) at oracle.jdbc.driver.OracleConnection.setAutoCommit(OracleConnection.java:812) at org.apache.ojb.broker.platforms.PlatformDefaultImpl.changeAutoCommitState(Un known Source) at org.apache.ojb.broker.accesslayer.ConnectionManager.localRollback(Unknown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.abortTransaction(Unknow n Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.close(Unknown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.finalize(Unknown Source) at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method) at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:86) at java.lang.ref.Finalizer.access$100(Finalizer.java:17) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:163) [org.apache.ojb.broker.accesslayer.ConnectionManager] INFO: Rollback was called, do rollback on current connection [EMAIL PROTECTED] [org.apache.ojb.broker.accesslayer.ConnectionManager] INFO: Rollback was called, do rollback on current connection [EMAIL PROTECT
Transactional isolation at the object layer
I'm using 1.0 rc1 with the PB API. I'm noticing that I don't have any isolation between multiple brokers when caching is enabled. For example: Object[] pk = new Object[] {new Long(42)}; Identity id = new Identity(Article.class, pk); PersistenceBroker broker1 = PersistenceBrokerFactory.defaultPersistenceBroker(); broker.beginTransaction(); Article a1 = (Article) broker.getObjectByQuery(new QueryByIdentity(id)); a1.articleName = "My article"; // start a second transaction PersistenceBroker broker2 = PersistenceBrokerFactory.defaultPersistenceBroker(); broker2.beginTransaction(); Article a2 = (Article) broker.getObjectByQuery(new QueryByIdentity(id)); // a2 is another reference to the same Article as a1 a2.unit = "kg"; broker2.abortTransaction(); broker.store(a1, ObjectModificationDefaultImpl.UPDATE); broker.commitTransaction(); broker2.close(); broker.close(); The changes that I made on the aborted broker2 transaction end up getting persisted on the broker1 transaction because they're sharing the same object reference. Similarly changes made on other transactions are visible even before they're committed. In general it doesn't look like I have any transactional isolation if caching is turned on. I guess my gut expectation was that caches would be broker specific and there would be communication between caches to coordinate invalidations on updates and deletes. So how do other people deal with this? I had thought maybe I could manage two jdbc-connection-descriptors pointing to the same database, one with a cache used only for reads and another with caching turned off used for updates but it looks like the caching policy is global not on a per descriptor basis. Am I missing something obvious?
Implementing Single Table Aggregation in OJB
Could anyone tell me how to implement the Single Table Aggregation pattern for a 1:1 relation using OJB? RowReaders seem to solve the problem for reading, but I'm stumped as to how to write to such a table. The pattern is found here: http://www.objectarchitects.de/ObjectArchitects/orpatterns/MappingObjects2Tables/SingleTableAggregation/ Any help is *greatly* appreciated.
Primary Key problem
I'm still using 0.9.8 and I'm having a primary key issue. I put a record into the database (Oracle) through a SQL client, and just fill in the primary key. Then when I start up and do a select, the primary key that is being shown is one that is generated by OJB, even though the one in the database is different. Anyone know what I'm doing wrong? This is very frustrating because right now, it seems that I can only add records through OJB and not any other way! Any ideas on this would be much appreciated. Jason - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
exception thrown when autobuild is used with mysql
Hi, I am testing OJB's tutorial 5 using OJB ver 1.0-RC1 to persist to MySQL ver. 3.23.54 with MySQL JDBC driver ver. 3.0.6. All is fine until I set autobuild property to true. Once I have set this, I am thrown a connection closed exception. The detail of the exception is as shown below [JDO] DEBUG: OjbStoreConnector.begin: connectionReadyForRelease=false [org.apache.ojb.broker.accesslayer.StatementsForClassImpl] ERROR: No operations allowed after connection closed java.sql.SQLException: No operations allowed after connection closed at com.mysql.jdbc.Connection.checkClosed(Connection.java:2414) at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1272) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.prepareState ment(StatementsForClassImpl.java:241) at org.apache.ojb.broker.accesslayer.StatementsForClassImpl.getPreparedS tmt(StatementsForClassImpl.java:182) at org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement . Please advice. thank you /lim/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ODMG bind() equivelant for PersistenceBroker?
Probably a dumb question but. is there something like query.bind() that I can with PB? I want to use PB because it seems more flexible but I *really* like being able to create a query and use bind() like I can with ODMG. Thanks - Do you Yahoo!? Yahoo! Web Hosting - establish your business online
Re: Interesting (failing) scenario of FKs/PKs in PB
hi all, i fixed this problem by assigning the foreign keys when the first check fails. after this assignement i do another check which MUST be successful otherwise an PersistenceBrokerException is thrown. so it no longer dies silently. the reason i do this two step approach is that i'm not sure whether it's ALWAYS safe to to the foreign key assignement before the check. hth jakob Armin Waibel wrote: - Original Message - From: "V.B. Skrypnyk" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]>; "Armin Waibel" <[EMAIL PROTECTED]> Sent: Wednesday, March 12, 2003 11:01 PM Subject: Re: Interesting (failing) scenario of FKs/PKs in PB Interestingly it fails silently, because after the assertion of primary keys the storeToDb() simply returns. Maybe foreign references should be expanded before the primary keys are asserted... sounds good (means I don't have a clue ;-)). This part of OJB is definitely not my special subject. If you find a solution I will check in your code. Test is in, let the gurus make the work ;-) regards, Armin --Bill. - Original Message - From: "Armin Waibel" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Wednesday, March 12, 2003 1:49 PM Subject: Re: Interesting (failing) scenario of FKs/PKs in PB The test fails because after commit none object was persisted to database. regards, Armin - Original Message - From: "V.B. Skrypnyk" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]>; "Armin Waibel" <[EMAIL PROTECTED]> Sent: Wednesday, March 12, 2003 10:37 PM Subject: Re: Interesting (failing) scenario of FKs/PKs in PB Hi Armin, I can only see 2 slight variances from my case: 1. My class doesn't have an autoincrement primary key 2. The reference is set from an object that already exists (it's not saved in the same transaction) I don't know if these variances are material. Does the test pass? (I can't seem to compile the project, there seem to be some problems with the StatementManager) --Bill. - Original Message - From: "Armin Waibel" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Wednesday, March 12, 2003 10:46 AM Subject: Re: Interesting (failing) scenario of FKs/PKs in PB Hi Christian, Bill I currently add a new test case to demonstrate the described behaviour. Could you check if I hit the bull's eye. See ReferenceTest#testRepositoryFKStore regards, Armin - Original Message - From: "Malinescu, Cristian" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Wednesday, March 12, 2003 6:15 PM Subject: RE: Interesting (failing) scenario of FKs/PKs in PB Hi Yes, I succeeded to this behaviour but only for Oracle, for MySQL was going OK, and for my typical situation I needed only one PK, no FK. This was strange for me, and I posted one email on this theme last week, but till now no remark/comment. I'm using the PB basic API. regards, Cristian -Original Message- From: V.B. Skrypnyk [mailto:[EMAIL PROTECTED] Sent: Mittwoch, 12. März 2003 18:02 To: OJB Users List Subject: Re: Interesting (failing) scenario of FKs/PKs in PB Has anyone else encountered this problem? --Bill. Hi, The following fails to be stored by PersistenceBroker: I have a class ACL which has two primary keys: objectId and userFK, and userFK is also a foreign key tied to a reference of type User. If I do this: persistentBroker.beginTransaction(); ACL acl = new ACL(); acl.setObjectId( 100 ); acl.setUser( currentUser ); persistentBroker.store(acl); persistentBroker.commitTransaction(); Acl will not be saved. The reason seems to be because in the storeToDb() method of the PersistentBroker, there first comes an assertion of the PrimaryKeys and afterwards comes the assignment of all the foreign keys. In the scenario above the assertion of the primary keys will fail, because the userFK has not been assigned yet, so we have an incomplete set of primary keys. This does work with the ODMG layer, probably because of a different sequence of events during the storing of the object. I wonder if there should be a check whether a primary key is shared by the foreign key and allow that assignment before the assertion of the primary keys is performed. Any ideas? Cheers, --Bill. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additiona
RE: locking and sql server..(was 'is this an old .97 bug?')
Just a follow up to this... setting the isolation level to 'serializable' does no good for preventing SequenceGenerator from giving out duplicate sequences when running multiple servlet engines on the same database (Using SQL server). In theory it should, but it doesn't. 2 App servers can read the same row at once, but with the isolation only 1 can update at once. But since both server have the same sequence value, the second app server just overwrites the table with the same value! Does anyone here run multiple servlet engines/app server farm using ojb? I don't see how this works (at least in SQL server). Anyways I'm going to take a stab at modifying PlatformMsSQLServerImpl.java to support a stored procedure for getting sequences - that way there is only 1 query like in the PlatformOracleImpl.java that bumps the sequence up and grab a new one at once. I'm hoping that will take care of it. If I can contribute it back into the ojb code base it might save others this headache :) Ryan -Original Message- From: Ryan Vanderwerf Sent: Tuesday, March 11, 2003 5:40 PM To: [EMAIL PROTECTED] Subject: locking and sql server..(was 'is this an old .97 bug?') Hi there, I posted a while back about a problem I was having that we thought was related to caching of sequences. This bug would cause 2 app servers who are doing inserts at the same time get the same key out of OJB_HL_SEQ. This would then results in the 1st insert doing the actual insert with that key, then the second app server would do an update, overwriting the original inserted record. We thought we had a solution by changing SequenceGenerator to flush the cache before getting a new sequence (see below). However this didn't actually fix the problem - it seems that even when I run OJB (I'm using 0.9.9, PB api) with the 'ObjectCacheEmptyImpl' class I still have the problem! It looks like SQL server isn't locking the transactions property, or I'm not setting the right isolation level in OJB. It appears that 2 app servers grab out of the OJB_HL_SEQ table at exact same time (looks like milliseconds differences), and they both get the same key! This trickles down on the line of 2 objects with the same id, the second one wins when OJB does an update over the original record. Armin, do you have any ideas? It almost seems like even though a transaction is in progress while SequenceGenerator is in progress, it doesn't lock another application/instance from grabbing the next value for that row! I'm assuming the database should take care of this, or I have to configure OJB to tell it to. SQL Server says it defaults to READ_UNCOMMITED state. I thought I saw a setting for this in an older OJB version, but it seems to be removed or moved somewhere. I see on the repository-junit it has a setting on an Article class on 'isolation-level=read_uncommited' - does that mean I can adjust the isolation level on OJB_HL_SEQ by editing it's entry in the repository_internal.xml to look like below? (for example) - class-descriptor class="org.apache.ojb.broker.util.sequence.HighLowSequence" table="OJB_HL_SEQ" isolation-level="read-committed" I've head from the OPTA folks (inetsoftware.de) some examples, but I'm not sure which OJB is doing is behind the scenes: How to create a read lock on a record for update There are no absolute read locks for the SQL Server. The reading connection needs to support the read lock (transaction isolation level). 1. case The writing connection started a transaction with: setAutoCommit ( false ); After the first update of data there is a read lock if the reading connection has an isolation level of TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ or TRANSACTION_SERIALIZABLE. The read lock ends with the end of the transaction ( setAutoCommit (true), commit(), rollback() ). 2. case The writing connection has not started a transaction ( setAutoCommit(true) ) and create a JDBC(tm) 2.0 statement with: createStatement(ResultSet.TYPE_SCROLL_SENSITIVE ,ResultSet.CONCUR_UPDATABLE+1); After the first update of data there is a read lock if the reading connection has an isolation level of TRANSACTION_SERIALIZABLE. The read lock ends if the ResultSet scrolls to the next fetch block ( setFetchSize() ). Ryan --- Indeed that's a better workaround for the problem. But the same problems (you have with HighLowSequence) could occur with any other persistent capable object. Say server1 and server2 cache object A, now server1 update A-->A'. Then server2 do a select for A and found A not A'. Server2 never will get the update version of A. Thus you need a distributed cache (JCS or a JMS based in J2EE compilant environments), or a cache only exists e.g. for a transaction, or as long as you do close the PersistenceBroker instance, or a cache implementation remove objects afte
Re: OJB 0.9.9 and Oracle 817 always rollback
Hi Really? I attempted to try 0.9.8, but I found that my code has used some 0.9.9 APIs; couldn't even start an ODMG instance. I think there may be a bug in reading the result set. I tried that there's no problem if the returning query is empty For DB2 connection, do you use jdbc-level="1.0"? I think the bug is in 1.0, since M$SQL, and MySQL uses 2.0 Defaulting JETTY_HOME to /opt/jetty Running Jetty: - Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true - Initializing, config='org.apache.struts.action.ActionResources', returnNull=true - Initializing, config='com.entersys.escds.webapp.ApplicationResources', returnNull=true java.lang.NoSuchMethodError at com.entersys.util.DAOHelper.buildDefDatabase(DAOHelper.java:50) at com.entersys.util.DAOHelper.(DAOHelper.java:40) at com.entersys.util.DAOHelper.getInstance(DAOHelper.java:59) at com.entersys.util.JcrontabDAO.findAll(JcrontabDAO.java:95) at org.jcrontab.data.CrontabEntryDAO.findAll(CrontabEntryDAO.java:77) at org.jcrontab.Cron.readCrontab(Cron.java:241) at org.jcrontab.Cron.generateEvents(Cron.java:256) at org.jcrontab.Cron.run(Cron.java:151) Thomas - Original Message - From: "Guido Beutler" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Thursday, March 13, 2003 4:53 PM Subject: Re: OJB 0.9.9 and Oracle 817 always rollback > Hi, > > did you trie 0.9.8 ? > I got the same problem with 0.9.9 and 1.0.rc1 and JBoss 3.0.4. with DB/2. > 0.9.8 is working well for me. > > cheers, > > Guido > > > - Original Message - > From: "Thomas Phan" <[EMAIL PROTECTED]> > To: "OJB Users List" <[EMAIL PROTECTED]>; "Armin Waibel" > <[EMAIL PROTECTED]> > Sent: Thursday, March 13, 2003 2:56 AM > Subject: Re: OJB 0.9.9 and Oracle 817 always rollback > > > > Hi Armin, > > > > I still get the exception after changing the conf to: > > > > > jcd-alias="default" > > default-connection="true" > > platform="Oracle" > > jdbc-level="1.0" > > driver="oracle.jdbc.driver.OracleDriver" > > protocol="jdbc" > > subprotocol="oracle" > > dbalias="thin:@localhost:1521:es" > > username="esf" > > password="esf" > > eager-release="false" > > batch-mode="false" > > useAutoCommit="0" > > ignoreAutoCommitExceptions="true" > > > > > > > > maxActive="21" > > validationQuery="" /> > > > > > > className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl"> > > > > > > > > > > [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: > Create > > new connection > > pool:[EMAIL PROTECTED] > > jcd-alias=default > > default-connection=true > > dbms=Oracle > > jdbc-level=1.0 > > driver=oracle.jdbc.driver.OracleDriver > > protocol=jdbc > > sub-protocol=oracle > > db-alias=thin:@localhost:1521:es > > user=esf > > password=* > > eager-release=false > > ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1, > maxActive=21, > > maxWait=5000, removeAbandoned=false, numTestsPerEvictionRun=10, > > testWhileIdle=false, minEvictableIdleTimeMillis=60, > testOnReturn=false, > > logAbandoned=false, removeAbandonedTimeout=300, > > timeBetweenEvictionRunsMillis=-1, testOnBorrow=true} > > batchMode=false > > > > > [EMAIL PROTECTED] > > sequenceManagerClass=class > > org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl > > Properties={grabSize=20} > > ] > > ] > > [2003-03-13 09:23:06,755 LV: INFO CL:jcrontab] > > org.jcrontab.data.DataNotFoundException: No CrontabEntries available > > [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: Rollback > was > > called, do rollback on current connection > > [EMAIL PROTECTED] > > [org.apache.ojb.broker.accesslayer.StatementsForClassImpl] ERROR: Io > > exception: Bad file descriptor > > java.sql.SQLException: Io exception: Bad file descriptor > > > > Thomas > > - Original Message - > > From: "Armin Waibel" <[EMAIL PROTECTED]> > > To: "OJB Users List" <[EMAIL PROTECTED]> > > Sent: Thursday, March 13, 2003 3:51 AM > > Subject: Re: OJB 0.9.9 and Oracle 817 always rollback > > > > > > > Hi Thomas, > > > > > > did you tried > > > > > > eager-release=false > > > batchMode=false > > > > > > regards, > > > Armin > > > > > > - Original Message - > > > From: "Thomas Phan" <[EMAIL PROTECTED]> > > > To: "OJB Users List" <[EMAIL PROTECTED]> > > > Sent: Wednesday, March 12, 2003 8:08 PM > > > Subject: OJB 0.9.9 and Oracle 817 always rollback > > > > > > > > > > Hi, > > > > > > > > I couldn't get OJB to work with Oracle, while connecting to Oracle > > > thur a > > > > raw JDBC should work. Did anyone encounter this problem? Am I > > > configured OJB > > > > to generate Oracle queries correctly? I've an UTF-8 instance, and set > > > > NLS_LANG=.UTF8, and most of my database's tables are empty (contain no > > > row) > > > > >
migrating Torque to OJB
I'm evaluating migrating from Torque to OJB. Can anyone provide any experience, feedback, suggestions, time estimates, etc on doing this? Eric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Multiples jdbc-connection-descriptor ??
All, I would like to have different declaration for different jcd-alias. But each time I try to put a second one, I have the error in websphere : "The markup in the document following the root element must be well formatted". I don't understand ?? I also wonder how to call the specific jcd-alias in the source code?? Tx ! Here is my repository_database.xml:
Detecting constraint violations using ODMG
I am in the process of junit-testing an application that is using the ODMG api. I am intentionally violating UNIQUE constraints in the junit tests for my application, and I am now trying to figure out how to handle the resultant exception: org.odmg.TransactionAbortedException: Batch entry 0 [Ljava.lang.Object;@89cc5e was aborted. Is there a way to get the underlying SQL error? Or is there some other way to detect a constraint violation? (Besides business logic). yuji Yuji Shinozaki Computer Systems Senior Engineer [EMAIL PROTECTED] Advanced Technologies Group (804)924-7171 Information Technology & Communication http://www.people.virginia.edu/~ys2nUniversity of Virginia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ODMG w/oracle problem
That's the strange part, I don't get a full null pointer exception traceback. As near as I can tell, the call to query.execute() silently returns a null with no other message. the code is straight from the examples (I think I actually cause the NullPointer later by trying to use the "rawResults", so it's just quietly not doing anything?!?) tx.begin(); // 2. get an OQLQuery object from the ODMG facade OQLQuery query = odmg.newOQLQuery(); // 3. set the OQL select statement query.create(sql); // 4. perform the query and store the result // in a persistent Collection DList rawResults = (DList) query.execute(); Armin Waibel wrote: Where is the Nullpointer stack trace? Your snip seems OK. regards, Armin - Original Message - From: "Larry Schuler" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 13, 2003 12:52 AM Subject: ODMG w/oracle problem Hi, I'm just starting to use OJB, so I think this may be configuration related, but I can use the PersisetenceBroker to retrieve objects, so I think I have it set up correctly. Anyway, when I try to use the ODMG method of access, OJB seems to load up ok, but when I try to retrieve objects, I get a NullPointerException with very little other details, here is a debug trace: (What I think may be the problem is the call to "PB.close", why would that be called right after opening?) The final message (select) is all that I receive in the log. My client app is reporting a failure due to a NullPointerException in the server. Thanks for any help. --Larry 08:56:20,751 INFO RepositoryPersistor:? - Read connection repository from file took 150 ms 08:56:20,821 INFO PersistenceBrokerFactoryDefaultImpl:? - Set default PBKey: or g.apache.ojb.broker.PBKey: repository=MAGE, user=magedev, password=* 08:56:20,831 DEBUG PersistenceBrokerFactoryDefaultImpl:? - createPersistenceBrok er(key) called 08:56:20,831 INFO PersistenceBrokerFactoryDefaultImpl:? - Create new PB instanc e for PBKey org.apache.ojb.broker.PBKey: repository=MAGE, user=magedev, password =*, already created persistence broker instances: 0 08:56:20,861 DEBUG SequenceManagerFactory:? - Default sequence manager class was org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl 08:56:20,861 DEBUG SequenceManagerFactory:? - create new sequence manager for br oker [EMAIL PROTECTED] 08:56:20,861 DEBUG SequenceManagerFactory:? - Jdbc-Connection-Descriptor 'MAGE' use sequence manager: class org.apache.ojb.broker.util.sequence.SequenceManagerH ighLowImpl 08:56:20,911 DEBUG OJB:? - Set current database org.apache.ojb.odmg.DatabaseImpl @811c88 PBKey was org.apache.ojb.broker.PBKey: repository=MAGE, user=magedev, pa ssword=* 08:56:20,911 DEBUG DatabaseImpl:? - Open database using PBKey org.apache.ojb.bro ker.PBKey: repository=MAGE, user=magedev, password=* 08:56:20,911 DEBUG PersistenceBrokerImpl:? - PB.close was called: org.apache.ojb [EMAIL PROTECTED] Debug2 * Mage Manager bound 08:56:34,381 DEBUG TransactionImpl:? - Begin transaction was called on tx org.ap [EMAIL PROTECTED], with associated PB null 08:56:34,391 DEBUG OQLQueryImpl:? - create query for query-string: select * from ContactImpl - 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: Object containing List of other objects
Try this, For class B: add an attribute to model fk to A. public class B { private Integer id; private A a; private int fkToA; ... } and change class descriptor of B like this: Houar -Message d'origine- De :Peter Kirk [mailto:[EMAIL PROTECTED] Envoyé :jeudi 13 mars 2003 11:39 À : 'OJB Users List' Objet : Object containing List of other objects Hi there, I would be grateful if someone could take the time to look at this and tell me what I am doing incorrectly. I have an object A which contains a List of B objects. Each B object also contains the object A which owns it. I am trying to persist A via ODMG (and by persisting A I also want all the B's to be persisted). I get an error like this: [org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl] ERROR: while set field: object class[ dk.pk.data.B target field: a target field type: class dk.pk.data.A object value class: java.lang.Integer object value: 259] [org.apache.ojb.odmg.TransactionImpl] ERROR: Locking obj dk.pk.data.A[id=259] with lock mode 4 failed Error setting field:a in object:dk.pk.data.B: field type mismatch java.lang.IllegalArgumentException: field type mismatch Here is my repository xml for A and B: Here are my A and B and IdConversion classes: public class A{ private Integer id; private List bList; public List getBList(){ return bList; } public Integer getId(){ return id; } public void setBList( List bList ){ this.bList = bList; } public void setId( Integer id ){ this.id = id; } } public class B{ private Integer id; private A a; public A getA(){ return a; } public Integer getId(){ return id; } public void setA( A a ){ this.a = a; } public void setId( Integer id ){ this.id = id; } } public class IdConversion implements FieldConversion{ public Object javaToSql( Object source ) throws ConversionException{ return ((A) source ).getId(); } public Object sqlToJava( Object source ) throws ConversionException{ A a = new A(); a.setId((Integer)source); return a; } } Here is the code which I am trying to run: A a = new A(); List bList = new ArrayList(5); B b1= new B(); bList.add(b1); a.setBList(bList); Transaction tx = null; tx = odmg.newTransaction(); tx.begin(); tx.lock( a, Transaction.WRITE ); tx.commit(); The two database tables are created like this: CREATE TABLE A_TABLE(ID INTEGER) CREATE TABLE B_TABLE(ID INTEGER,A_ID INTEGER) Thanks, Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Object containing List of other objects
Try this, For class B: add an attribute to model fk to A. public class B { private Integer id; private A a; private int fkToA; ... } and change class descriptor of B like this: Houar -Message d'origine- De :Peter Kirk [mailto:[EMAIL PROTECTED] Envoyé :jeudi 13 mars 2003 11:39 À : 'OJB Users List' Objet : Object containing List of other objects Hi there, I would be grateful if someone could take the time to look at this and tell me what I am doing incorrectly. I have an object A which contains a List of B objects. Each B object also contains the object A which owns it. I am trying to persist A via ODMG (and by persisting A I also want all the B's to be persisted). I get an error like this: [org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl] ERROR: while set field: object class[ dk.pk.data.B target field: a target field type: class dk.pk.data.A object value class: java.lang.Integer object value: 259] [org.apache.ojb.odmg.TransactionImpl] ERROR: Locking obj dk.pk.data.A[id=259] with lock mode 4 failed Error setting field:a in object:dk.pk.data.B: field type mismatch java.lang.IllegalArgumentException: field type mismatch Here is my repository xml for A and B: Here are my A and B and IdConversion classes: public class A{ private Integer id; private List bList; public List getBList(){ return bList; } public Integer getId(){ return id; } public void setBList( List bList ){ this.bList = bList; } public void setId( Integer id ){ this.id = id; } } public class B{ private Integer id; private A a; public A getA(){ return a; } public Integer getId(){ return id; } public void setA( A a ){ this.a = a; } public void setId( Integer id ){ this.id = id; } } public class IdConversion implements FieldConversion{ public Object javaToSql( Object source ) throws ConversionException{ return ((A) source ).getId(); } public Object sqlToJava( Object source ) throws ConversionException{ A a = new A(); a.setId((Integer)source); return a; } } Here is the code which I am trying to run: A a = new A(); List bList = new ArrayList(5); B b1= new B(); bList.add(b1); a.setBList(bList); Transaction tx = null; tx = odmg.newTransaction(); tx.begin(); tx.lock( a, Transaction.WRITE ); tx.commit(); The two database tables are created like this: CREATE TABLE A_TABLE(ID INTEGER) CREATE TABLE B_TABLE(ID INTEGER,A_ID INTEGER) Thanks, Peter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Interesting (failing) scenario of FKs/PKs in PB
Hi , Following advice of Armin, I changed in repository_database.xml eager-release="true" batch-mode="true" to eager-release="false" batch-mode="false" and now insert works for my Oracle 8 instance. Regards, Cristian -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Mittwoch, 12. März 2003 23:59 To: OJB Users List Subject: Re: Interesting (failing) scenario of FKs/PKs in PB - Original Message - From: "V.B. Skrypnyk" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]>; "Armin Waibel" <[EMAIL PROTECTED]> Sent: Wednesday, March 12, 2003 11:01 PM Subject: Re: Interesting (failing) scenario of FKs/PKs in PB > Interestingly it fails silently, because after the assertion of primary keys > the storeToDb() simply returns. Maybe foreign references should be expanded > before the primary keys are asserted... > sounds good (means I don't have a clue ;-)). This part of OJB is definitely not my special subject. If you find a solution I will check in your code. Test is in, let the gurus make the work ;-) regards, Armin > --Bill. > > > - Original Message - > From: "Armin Waibel" <[EMAIL PROTECTED]> > To: "OJB Users List" <[EMAIL PROTECTED]> > Sent: Wednesday, March 12, 2003 1:49 PM > Subject: Re: Interesting (failing) scenario of FKs/PKs in PB > > > > The test fails because after commit none object > > was persisted to database. > > > > regards, > > Armin > > > > - Original Message - > > From: "V.B. Skrypnyk" <[EMAIL PROTECTED]> > > To: "OJB Users List" <[EMAIL PROTECTED]>; "Armin Waibel" > > <[EMAIL PROTECTED]> > > Sent: Wednesday, March 12, 2003 10:37 PM > > Subject: Re: Interesting (failing) scenario of FKs/PKs in PB > > > > > > > Hi Armin, > > > > > > I can only see 2 slight variances from my case: > > > 1. My class doesn't have an autoincrement primary key > > > 2. The reference is set from an object that already exists (it's not > > saved > > > in the same transaction) > > > > > > I don't know if these variances are material. Does the test pass? (I > > can't > > > seem to compile the > > > project, there seem to be some problems with the StatementManager) > > > > > > --Bill. > > > > > > > > > - Original Message - > > > From: "Armin Waibel" <[EMAIL PROTECTED]> > > > To: "OJB Users List" <[EMAIL PROTECTED]> > > > Sent: Wednesday, March 12, 2003 10:46 AM > > > Subject: Re: Interesting (failing) scenario of FKs/PKs in PB > > > > > > > > > > Hi Christian, Bill > > > > > > > > I currently add a new test case to demonstrate > > > > the described behaviour. > > > > Could you check if I hit the bull's eye. > > > > See ReferenceTest#testRepositoryFKStore > > > > > > > > regards, > > > > Armin > > > > > > > > - Original Message - > > > > From: "Malinescu, Cristian" <[EMAIL PROTECTED]> > > > > To: "'OJB Users List'" <[EMAIL PROTECTED]> > > > > Sent: Wednesday, March 12, 2003 6:15 PM > > > > Subject: RE: Interesting (failing) scenario of FKs/PKs in PB > > > > > > > > > > > > Hi > > > > Yes, I succeeded to this behaviour but only for Oracle, for MySQL > > was > > > > going > > > > OK, > > > > and for my typical situation I needed only one PK, no FK. > > > > This was strange for me, and I posted one email on this theme last > > week, > > > > but > > > > till > > > > now no remark/comment. I'm using the PB basic API. > > > > regards, > > > > Cristian > > > > > > > > -Original Message- > > > > From: V.B. Skrypnyk [mailto:[EMAIL PROTECTED] > > > > Sent: Mittwoch, 12. März 2003 18:02 > > > > To: OJB Users List > > > > Subject: Re: Interesting (failing) scenario of FKs/PKs in PB > > > > > > > > > > > > Has anyone else encountered this problem? > > > > > > > > --Bill. > > > > > > > > > Hi, > > > > > > > > > > The following fails to be stored by PersistenceBroker: > > > > > > > > > > I have a class ACL which has two primary keys: objectId and > > userFK, > > > > and > > > > > userFK is also a foreign key tied to a reference of type User. If > > I do > > > > this: > > > > > > > > > > persistentBroker.beginTransaction(); > > > > > ACL acl = new ACL(); > > > > > acl.setObjectId( 100 ); > > > > > acl.setUser( currentUser ); > > > > > persistentBroker.store(acl); > > > > > persistentBroker.commitTransaction(); > > > > > > > > > > Acl will not be saved. The reason seems to be because in the > > > > storeToDb() > > > > > method of the PersistentBroker, there first comes an assertion of > > the > > > > > PrimaryKeys and afterwards comes the assignment of all the foreign > > > > keys. > > > > In > > > > > the scenario above the assertion of the primary keys will fail, > > > > because > > > > the > > > > > userFK has not been assigned yet, so we have an incomplete set of > > > > primary > > > > > keys. This does work with the ODMG layer, probably because of a > > > > different > > > > > sequence of events during the storing of the object. > > > > > > > > > > I wonder if there should be a check whether a primary key is > > shared
workaorund for known sybase issue?, was: RE: Sybase: JZ0BE ...
Hello again, > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > The class has a lot of attributes. Maybe there is a size > limitation in sybase. We have found more information: this is sybase known issue #202534, see http://manuals.sybase.com/onlinebooks/group-jc/jcg0420e/jcon52rb/@Generic__B ookTextView/670 The problem applies only to Sybase ASE, not ASA. Once again my question: > Is there a way to fix/bypass that problem in OJB? Is is possible to configure OJB not to use batch updates? Isn't there anybody else with that problem? If there is no workaround yet, I will have to add one, because I have little hope that Sybase fixes that issue. Olli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Object containing List of other objects
Hi there, I would be grateful if someone could take the time to look at this and tell me what I am doing incorrectly. I have an object A which contains a List of B objects. Each B object also contains the object A which owns it. I am trying to persist A via ODMG (and by persisting A I also want all the B's to be persisted). I get an error like this: [org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldDefaultImpl] ERROR: while set field: object class[ dk.pk.data.B target field: a target field type: class dk.pk.data.A object value class: java.lang.Integer object value: 259] [org.apache.ojb.odmg.TransactionImpl] ERROR: Locking obj dk.pk.data.A[id=259] with lock mode 4 failed Error setting field:a in object:dk.pk.data.B: field type mismatch java.lang.IllegalArgumentException: field type mismatch Here is my repository xml for A and B: Here are my A and B and IdConversion classes: public class A{ private Integer id; private List bList; public List getBList(){ return bList; } public Integer getId(){ return id; } public void setBList( List bList ){ this.bList = bList; } public void setId( Integer id ){ this.id = id; } } public class B{ private Integer id; private A a; public A getA(){ return a; } public Integer getId(){ return id; } public void setA( A a ){ this.a = a; } public void setId( Integer id ){ this.id = id; } } public class IdConversion implements FieldConversion{ public Object javaToSql( Object source ) throws ConversionException{ return ((A) source ).getId(); } public Object sqlToJava( Object source ) throws ConversionException{ A a = new A(); a.setId((Integer)source); return a; } } Here is the code which I am trying to run: A a = new A(); List bList = new ArrayList(5); B b1= new B(); bList.add(b1); a.setBList(bList); Transaction tx = null; tx = odmg.newTransaction(); tx.begin(); tx.lock( a, Transaction.WRITE ); tx.commit(); The two database tables are created like this: CREATE TABLE A_TABLE(ID INTEGER) CREATE TABLE B_TABLE(ID INTEGER,A_ID INTEGER) Thanks, Peter
Antwort: Re: build.sh won't run -> FAQ suggestion
Thank you for the tip. Actually I solved it and have the build.sh runing, but I still don't know, why ... I had the same problem with the tutorial1.sh. Here is the case: When I start the skript, which is delivered with the OJB download: I get the following message: schnipp [EMAIL PROTECTED]:/misc/home/a322pc/db-ojb-1.0.rc1-tutorial> sh bin/tutorial1.sh : Datei oder Verzeichnis nicht gefunden/test/ojb : command not foundine 7: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ojb/tutorial1/Application : command not foundine 9: : Datei oder Verzeichnis nicht gefunden : Datei oder Verzeichnis nicht gefunden : Datei oder Verzeichnis nicht gefunden : command not foundine 13: [EMAIL PROTECTED]:/misc/home/a322pc/db-ojb-1.0.rc1-tutorial> schnapp What I did to have it run, was to rewrite the same skript in a new file. It seems like there is a problem with the carriage return (Zeilenumbruch), when the skript is written on one system and then used on a different one. This was a ugly one to solve. I suggest to put this solution in a OJB Installation FAQ. Anyway... the tutorial 1 is up and runing. :-) Thanks for the help. Carsten Dennis Ryan <[EMAIL PROTECTED]> on 12.03.2003 18:59:08 Bitte antworten an "OJB Users List" <[EMAIL PROTECTED]> An: OJB Users List Kopie: (Blindkopie: Carsten Pörtge) Thema: Re: build.sh won't run My German isn't very good, but I believe it is saying "file or directory not found" which probably means that the binaries are not executable? $ chmod +x bin/*.sh Give that a try. dennis [EMAIL PROTECTED] wrote: > > > Hello, > > I'm trying to install OJB on a linux computer. > I set the the JAVA_HOME to the JDK1.4. > I unpacked the OJB file. > I checked the rights to run the build.sh (rights == 555). > > now, I try to run junit, calling it from the ojb-directory: >bin/build.sh junit > > Here I get the message: >bash: /bin/build.sh: Datei oder Verzeichnis nicht gefunden > > Does anyone have an idea, why this won't work? > > Thanks for helping in advanced. > > Yours sincerely, > C. Pörtge > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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: Why can't work for deploying OJB(db-ojb-1.0.rc1) to Jboss3.0.4?
Hi Dogie, we adopt a new concept to make the PBKey independent from the repository.xml, by using the 'jcd-alias' name in PBKey. Thus in your case you should do somthing like PBF.createPersistenceBroker(new PBKey("default")); or PBF.createPersistenceBroker(new PBKey("default", "sa", "passwd")); or when the attribute default-connection="true" was set you could use the convenient PBF.defaultPersistenceBroker() The tests shown when using >=jboss 3.0.4 the eager-release attribute should be set to 'false'. An updated version of the deployment doc (deployment.xml) you could find under http://cvs.apache.org/viewcvs/db-ojb/xdocs/ replace the old one shipped with OJB and call "bin\build.bat htmldoc" HTH regards, Armin - Original Message - From: "½²³Õ¦Ü" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Thursday, March 13, 2003 4:22 AM Subject: Why can't work for deploying OJB(db-ojb-1.0.rc1) to Jboss3.0.4? Hi! I try to re-deploy 1.0.rc1 to Jboss3.0.4,but it can't work. I ever deployed 0.9.8 success. The repository_database.xml file as: I have followed the deployment doc step by step. It raised error message: 11:08:32,031 INFO [STDOUT] [org.apache.ojb.broker.metadata.ConnectionRepository] INFO: 11:08:32,046 INFO [STDOUT] Could not found org.apache.ojb.broker.metadata.JdbcC onnectionDescriptor for PBKey org.apache.ojb.broker.PBKey: repository=repository .xml, user=null, password=null 11:08:32,093 INFO [STDOUT] [org.apache.ojb.broker.accesslayer.ConnectionManager Factory] ERROR: 11:08:32,109 INFO [STDOUT] ConfigurableFactory instantiation failed for class c lass org.apache.ojb.broker.accesslayer.ConnectionManagerImpl * Factory types: 1 - Type: org.apache.ojb.broker.PersistenceBroker * Factory arguments: 1 - Argument: [EMAIL PROTECTED] 11:08:32,156 INFO [STDOUT] null 11:08:32,187 ERROR [STDERR] java.lang.reflect.InvocationTargetException : : What's wrong? Thanks. Dogie Tsai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB 0.9.9 and Oracle 817 always rollback
Hi, did you trie 0.9.8 ? I got the same problem with 0.9.9 and 1.0.rc1 and JBoss 3.0.4. with DB/2. 0.9.8 is working well for me. cheers, Guido - Original Message - From: "Thomas Phan" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]>; "Armin Waibel" <[EMAIL PROTECTED]> Sent: Thursday, March 13, 2003 2:56 AM Subject: Re: OJB 0.9.9 and Oracle 817 always rollback > Hi Armin, > > I still get the exception after changing the conf to: > > jcd-alias="default" > default-connection="true" > platform="Oracle" > jdbc-level="1.0" > driver="oracle.jdbc.driver.OracleDriver" > protocol="jdbc" > subprotocol="oracle" > dbalias="thin:@localhost:1521:es" > username="esf" > password="esf" > eager-release="false" > batch-mode="false" > useAutoCommit="0" > ignoreAutoCommitExceptions="true" > > > > maxActive="21" > validationQuery="" /> > > className="org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl"> > > > > > [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: Create > new connection > pool:[EMAIL PROTECTED] > jcd-alias=default > default-connection=true > dbms=Oracle > jdbc-level=1.0 > driver=oracle.jdbc.driver.OracleDriver > protocol=jdbc > sub-protocol=oracle > db-alias=thin:@localhost:1521:es > user=esf > password=* > eager-release=false > ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1, maxActive=21, > maxWait=5000, removeAbandoned=false, numTestsPerEvictionRun=10, > testWhileIdle=false, minEvictableIdleTimeMillis=60, testOnReturn=false, > logAbandoned=false, removeAbandonedTimeout=300, > timeBetweenEvictionRunsMillis=-1, testOnBorrow=true} > batchMode=false > > [EMAIL PROTECTED] > sequenceManagerClass=class > org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl > Properties={grabSize=20} > ] > ] > [2003-03-13 09:23:06,755 LV: INFO CL:jcrontab] > org.jcrontab.data.DataNotFoundException: No CrontabEntries available > [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: Rollback was > called, do rollback on current connection > [EMAIL PROTECTED] > [org.apache.ojb.broker.accesslayer.StatementsForClassImpl] ERROR: Io > exception: Bad file descriptor > java.sql.SQLException: Io exception: Bad file descriptor > > Thomas > - Original Message - > From: "Armin Waibel" <[EMAIL PROTECTED]> > To: "OJB Users List" <[EMAIL PROTECTED]> > Sent: Thursday, March 13, 2003 3:51 AM > Subject: Re: OJB 0.9.9 and Oracle 817 always rollback > > > > Hi Thomas, > > > > did you tried > > > > eager-release=false > > batchMode=false > > > > regards, > > Armin > > > > - Original Message - > > From: "Thomas Phan" <[EMAIL PROTECTED]> > > To: "OJB Users List" <[EMAIL PROTECTED]> > > Sent: Wednesday, March 12, 2003 8:08 PM > > Subject: OJB 0.9.9 and Oracle 817 always rollback > > > > > > > Hi, > > > > > > I couldn't get OJB to work with Oracle, while connecting to Oracle > > thur a > > > raw JDBC should work. Did anyone encounter this problem? Am I > > configured OJB > > > to generate Oracle queries correctly? I've an UTF-8 instance, and set > > > NLS_LANG=.UTF8, and most of my database's tables are empty (contain no > > row) > > > > > > My application works fine with both MSSQL and MySQL by changing the > > driver, > > > and the xmls, but not Oracle! > > > > > > Thanks > > > > > > Here's what I got: > > > > > > [org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl] INFO: > > Create > > > new connection > > > pool:[EMAIL PROTECTED] > > > jcd-alias=default > > > default-connection=true > > > dbms=Oracle > > > jdbc-level=1.0 > > > driver=oracle.jdbc.driver.OracleDriver > > > protocol=jdbc > > > sub-protocol=oracle > > > db-alias=thin:@localhost:1521:sid > > > user=esf > > > password=* > > > eager-release=true > > > ConnectionPoolDescriptor={whenExhaustedAction=0, maxIdle=-1, > > maxActive=21, > > > maxWait=5000, removeAbandoned=false, numTestsPerEvictionRun=10, > > > testWhileIdle=false, minEvictableIdleTimeMillis=60, > > testOnReturn=false, > > > logAbandoned=false, removeAbandonedTimeout=300, > > > timeBetweenEvictionRunsMillis=-1, testOnBorrow=true} > > > batchMode=true > > > > > > > > [EMAIL PROTECTED] > > 84f[ > > > sequenceManagerClass=class > > > org.apache.ojb.broker.util.sequence.SequenceManagerHighLowImpl > > > Properties={grabSize=20} > > > ] > > > ] > > > [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: > > Rollback was > > > called, do rollback on current connection > > > [EMAIL PROTECTED] > > > [org.apache.ojb.broker.accesslayer.StatementsForClassImpl] ERROR: Io > > > exception: Bad file descriptor > > > java.sql.SQLException: Io exception: Bad file descriptor > > > at > > oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169) > > > at > > oracle.jdbc.dbaccess
Newbie : OJB and multiple database ?
All, 1) I am going to choose OJB for our new persistence implementation. I would like to how if it is possible for one JDO object (one .class object) to access to different databases ? It is possible by calling different factory, that it ? But what about the profile file and the Ojb.properties. If you declare one profil with mysql for exemple (and with the db alias). How later in your source code is it possible to access to different database? 2) Is it possible to deploy OJB in Webshere environment? Thanks a lot !
Newbie : OJB and multiple database ?
All, 1) I am going to choose OJB for our new persistence implementation. I would like to how if it is possible for one JDO object (one .class object) to access to different databases ? It is possible by calling different factory, that it ? But what about the profile file and the Ojb.properties. If you declare one profil with mysql for exemple (and with the db alias). How later in your source code is it possible to access to different database? 2) Is it possible to deploy OJB in Webshere environment? Thanks a lot !
Is it possible to use OJB with Informix 7.31?
Is there some information about somewone who tried OJB on Informix 7 ? Thanks to Domagoj Jugovic [EMAIL PROTECTED], with his informix profile for Torque i can launch the samples. However I am unable to create this ojb-core table on Informix 7.31: [torque-insert-sql] Failed to execute: CREATE TABLE OJB_LOCKENTRY ( OID_ VARCHAR (250) NOT NULL, TX_ID VARCHAR (50) NOT NULL, TIMESTAMP_ DATETIME YEAR TO FRACTI ON, ISOLATIONLEVEL INTEGER, LOCKTYPE INTEGER, PRIMARY KEY(OID_,TX_ID)) [torque-insert-sql] java.sql.SQLException: Total length of columns in constraint is too long. Is there some workaround to solve the problem? Cordialement Edouard Chevtchouk -- This message is for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]