OJB Sample/Test classes mixed up with genuine OBJ APIs under same java packages
OJB team, Thank you for the great work on OJB. I have a suggestion regarding source organization of OJB. Currently most of the sample/test programs are put into the same package as the core OJB API classes, which is a bit confusing. Even though source files for test classes are separated under CVS in 'test' directory, java classes themselves are put under genuine OJB API packages without any clear separation. For e.g. test classes such as A, AB, AAlone, D, E, F, AutomaticForeignKeys, Qualifier, LockedByTimestamp etc., are mixed up in org.apache.ojb.broker package. These test classes are also in the OJB Javadoc (http://db.apache.org/ojb/api/index.html) making it look more confusing, when OBJ is used without source in applications development. It would be good to separate test and samples classes into their own sub packages such as org.apache.ojb.broker.test.* or so in order to cleanly separate OBJ APIs from Test/Sample code. Not sure if this issue was raised and beaten to death on this list before but I thought I will bring it up in case nobody bothered to raise it before. regards Varughese George
RE : problems with batch-mode=true
I read inb the doc but I didn't understood what the batch mode="true" means. Can someone explain it to me ? Tx ! -Message d'origine- De : Armin Waibel [mailto:[EMAIL PROTECTED] Envoyé : mardi 21 octobre 2003 22:58 À : OJB Users List Objet : Re: problems with batch-mode=true Hi Bonnie, Hope I can sheed some light on the 'problem'. > does this mean that you can't set batch mode to "true" > if it is set to "false" in repository_database.xml? yep! I think this behaviour has a big advantage, because it is easy to disable batch-mode by set batch-mode false in repository (if we don't have a bug in handling bach-mode ;-)) ... >> I am trying to insert records in batch mode. Perhaps I don't understand >> how this >> works. Here is my test code to insert 100 customers : >> Assume you have set batch-mode 'true' in repository file. Then you have to enable batch mode for the use PB instance. Try this: >> ConnectionManagerIF conMan = broker.serviceConnectionManager(); >> try >> { >> broker.beginTransaction(); ==>> broker.connectionManager.setBachMode(true); now the PB instance is running in batch-mode till you set false or the PB instance was closed. >> for (int i = 0; i < 100; i++) >> { >> >> CustomerInterface customer = new Customer(); >> customer.setCustomerNumber("100" + i); >> customer.setFirstName("Big"); >> customer.setLastName("Customer"); >> customer.setCustomerName("BadCorporation"); >> customer.setDeleteTag(Boolean.FALSE); >> >> broker.store(customer); >> } >> >> conMan.executeBatch(); think you don't need executeBatch before commit, this will be done at commit. >> broker.commitTransaction(); >> } >> If you still have problems with batch-mode try CVS-head. I think Oleg has checked in some changes (but I'm not sure) regards, Armin >> When I run this with batch-mode="false", it works perfectly, although it >> generates a SELECT and a >> DELETE for every INSERT (which seems rather inefficient). I imagine this >> has something to do with >> an M:N nondecomposed relationship which involves Customer records. >> >> When I run this with batch-mode="true", it fails. I get the following >> exception >> java.lang.IllegalArgumentException: object is not an instance of >> declaring >> class >> at java.lang.reflect.Method.invoke(Native Method) >> at >> org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doExec >> ute(Unknown Source) >> at >> org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke >> (Unknown Source) >> at $Proxy0.doExecute(Unknown Source) >> at >> org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown >> Source) >> at >> org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.executeBatch(Unkno >> wn Source) >> at >> com.mobius.activebill.dbmigrationutils.CustomerMigration.main(CustomerMigr >> ation.java:68) >> rethrown as org.apache.ojb.broker.accesslayer.OJBBatchUpdateException: >> object is not an instance of declaring class >> at >> org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.executeBatch(Unkno >> wn Source) >> at >> com.mobius.activebill.dbmigrationutils.CustomerMigration.main(CustomerMigr >> ation.java:68) >> when conMan.executeBatch() is called. >> >> Am I doing something wrong here? I am using rc4, with MSSqlServer and >> JSQLConnect. >> >> thanks, >> Bonnie MacKellar - 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]
Can OJB solve the problem?
Hi there, I have to databases, and I need to extract data from two tables, one from the first database and the other from the second. For example: I have "sigdb" database and in it a table "users" with pk userid. Also I have a second database "workdata" with table "worklog with column userid. So what I needed is to get from "workdata"."worklog" all the records and for each record to get the user details from "sigdb"."users". And if possible to make this with one select :)) I use XADataSource. Thanks and Cheers 15 Mbytes Free Web-based and POP3 Sign up now: http://www.gawab.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem mapping differnent object to one table
has anyone been successfully mapping two objects to the same table?? to be more specific, i would like distinct object instances for objectAId and distinct object instances for objectBId in seperate queries. select distinct objectA_id from tableAB; select distinct objectB_id from tableAB; i have used the distinct clause on the QueryCriteria class but i have not been successfully, because OJB wants to concatenate objectAId and objectBid together in the following sql; select distinct objectA_id, objectB_id from tableAB; why does OJB combine objectA_id and objectB_id in the select clause of the query if two class descriptors exist for the same table? i did try the reportQuery to restrict the columns. i got the sql that is generated seems to be correct. however ojb is throwing an invalid class cast exception which i don't understand. any thoughts are much appreciated? - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
Very bad performance with big Tables
I have a problem with big tables and MS SQL Server. The table has more than 5 million records. Select and Update statements are very slow. I think the problem is the statement with parameters generated by ojb. The statement with the parameter syntax runs almost 6 seconds, without it just takes mills. Has someone also recognized is problem. Does someone knows why this syntax is so slow and has some suggestions how to fix it. Is there an easy way to change the statement generation, if there are no other advices. Example First takes 6 sec exec sp_executesql N'UPDATE History SET [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],hisLastModifier [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],hisAttac [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED] 11 WHERE hisOID = @P12 ', N'@P1 datetime ,@P2 nvarchar(4000) ,@P3 datetime ,@P4 nvarchar(4000) ,@P5 nvarchar(4000) ,@P6 nvarchar(4000) ,@P7 datetime ,@P8 nvarchar(4000) ,@P9 nvarchar(4000) ,@P10 nvarchar(4000) ,@P11 nvarchar(4000) ,@P12 nvarchar(4000) ', 'Jul 28 2003 5:17:32:000PM', N'ibrahimk', 'Okt 20 2003 5:29:29:777PM', N'SYSTEM', N'SV: xxx', N'', 'Jul 28 2003 5:17:31:000PM', NULL, N'90', N'1080', N'5CCFCCE8-B144-11D7-A860-0007E90F2D57', N'FC7C1593-9D39-4D21-9E02-B86F91DCCDD7' Second takes just mills exec sp_executesql N'UPDATE History SET hisLockTimestamp=''Jul 28 2003 5:17:31:000PM'',hisLockUser=''ibrahimk'',hisLastModified=''Jul 28 2003 5:17:31:000PM'',hisLastModifier=''SYSTEM'',hisShortDescription=''SV: xxx'',hisDescription=,hisCreation=''Jul 28 2003 5:17:31:000PM'',hisAttachmentOID=,hisOrderStatusOID=''90'',hisHistor yTypeOID=''1080'',hisOrderOID=''5CCFCCE8-B144-11D7-A860-0007E90F2D57'' WHERE hisOID = ''FC7C1593-9D39-4D21-9E02-B86F91DCCDD7''' with kind regards Markus Denkinger ARMAX mindware GmbH Bernhäuser Strasse 3 70771 Leinfelden-Echterdingen Fon: 0711 7823996-13 Fax: 0711 7823996-63 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Very bad performance with big Tables
Hey I have a problem with big tables and MS SQL Server. The table has more than 5 million records. Select and Update statements are very slow. I think the problem is the statement with parameters generated by ojb. The statement with the parameter syntax runs almost 6 seconds, without it just takes mills. Has someone also recognized is problem. Does someone knows why this syntax is so slow and has some suggestions how to fix it. Is there an easy way to change the statement generation, if there are no other advices. Example First takes 6 sec exec sp_executesql N'UPDATE History SET [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],hisLastModifier [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],hisAttac [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED] 11 WHERE hisOID = @P12 ', N'@P1 datetime ,@P2 nvarchar(4000) ,@P3 datetime ,@P4 nvarchar(4000) ,@P5 nvarchar(4000) ,@P6 nvarchar(4000) ,@P7 datetime ,@P8 nvarchar(4000) ,@P9 nvarchar(4000) ,@P10 nvarchar(4000) ,@P11 nvarchar(4000) ,@P12 nvarchar(4000) ', 'Jul 28 2003 5:17:32:000PM', N'ibrahimk', 'Okt 20 2003 5:29:29:777PM', N'SYSTEM', N'SV: xxx', N'', 'Jul 28 2003 5:17:31:000PM', NULL, N'90', N'1080', N'5CCFCCE8-B144-11D7-A860-0007E90F2D57', N'FC7C1593-9D39-4D21-9E02-B86F91DCCDD7' Second takes just mills exec sp_executesql N'UPDATE History SET hisLockTimestamp=''Jul 28 2003 5:17:31:000PM'',hisLockUser=''ibrahimk'',hisLastModified=''Jul 28 2003 5:17:31:000PM'',hisLastModifier=''SYSTEM'',hisShortDescription=''SV: xxx'',hisDescription=,hisCreation=''Jul 28 2003 5:17:31:000PM'',hisAttachmentOID=,hisOrderStatusOID=''90'',hisHistor yTypeOID=''1080'',hisOrderOID=''5CCFCCE8-B144-11D7-A860-0007E90F2D57'' WHERE hisOID = ''FC7C1593-9D39-4D21-9E02-B86F91DCCDD7''' with kind regards Markus Denkinger ARMAX mindware GmbH Bernhäuser Strasse 3 70771 Leinfelden-Echterdingen Fon: 0711 7823996-13 Fax: 0711 7823996-63 [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
dynamic database connections and schemas
dear ojb user list, i was asked to describe my thoughts about dynamic database connections and schemas. See below, chris tava let's suppose you are tasked with writing data to multiple databases accounts with the same schema. let's call the schema, the v1.0.0 schema. when i use the word schema i am refering to the physcial model - relational database model. obviously, using the OJB tool you can create an object.attribute to relational table.column map (O-R map). and you can use the PBKey class to make a connection to any account using a specific O-R map. PBKey pbKey = new PBKey("v1.0.0",getAccountName(), getAccountPass()); PersistenceBroker pBroker = pBrokerFactory.createPersistenceBroker(pbKey); now, let's suppose the next version of the system comes out and you have a new database schema, let's call the v2.0.0 schema. and let's suppose only a few of the database accounts are updated at a given time. therefore, if you have some key identifier in your system that determines which version of the schema at particular database account is using, then you can use this information to make a connection to the specific database accounts using specific schemas. if (schemaVersion.equals("v1.0.0") { PBKey pbKey = new PBKey("v1.0.0", getAccountName(),getAccountPass()); } else if (schemaVersion.equals("v2.0.0") { PBKey pbKey = new PBKey("v2.0.0", getAccountName(),getAccountPass()); } - Do you Yahoo!? The New Yahoo! Shopping - with improved product search
RE: Update Problem
Turns out that for the table in question, I have a foreign key reference setup and the value for the field-ref-id was set to the id of the primary key and not to the field that is the foreign-key. As a result, every time I tried an update, the primary key got set to null since, I suppose, I didn't have an active reference to the "foreign" object. I suppose there are situations where you might want your table's primary key to also be a foreign key, but I'm not sure what they would be. Maybe there should be a sanity check on the repository.xml, beyond just syntax? hi, check that the primary key is not set to null in the object that you are going to store. If the primary key is of numeric type, also check that the value is not 0 (not primitive 0 nor Number.longValue() == 0), or it will be interpreted as null causing an insert instead of an update. hope to be of any help danilo I'm having a problem with updates. I haven't had this problem in the past with OJB, and thought I'd throw out a question before I start stepping through the code. I've been using OJB for the last 18 months and don't remember seeing this problem. I query OJB to get my object to update, using the primary key. I update the object, then call broker.store to update the object. However, the object, which is defined in th repository with "autoincrement=true" for the primary key, is INSERTed and NOT updated. I've tried this with HSQLDB and ORACLE. It's happening with both. I'm using release candidate 4 of OJB. Any hints are greatly appreciated. Oh, and I've tried explicitly telling OJB to do an update not an insert. -- Charles E Brault [EMAIL PROTECTED] "Where are we going, and why am I in this handbasket?" - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bizarre Problem running against JBoss...
More investigation -- that didn't solve it. I *think* what causes is redeploying the application and having cached objects. Not sure, investigating further. If I don't redeploy on a running server after running unit tests once it doesn't happen. -Brian On Tuesday, October 21, 2003, at 08:30 PM, Brian McCallister wrote: That did it, though I dislike having to deploy the persistent objects with OJB itself =/ Need to look into JBoss classloading. -Brian On Tuesday, October 21, 2003, at 05:48 PM, Armin Waibel wrote: Hi Brian, On Tue, 21 Oct 2003 17:37:22 -0400, Brian McCallister <[EMAIL PROTECTED]> wrote: 17:29:48,031 INFO [STDOUT] Candidate object [EMAIL PROTECTED] class [com.forthillcompany.eva.model.Profile] is not a subtype of [com.forthillcompany.eva.model.Profile] or any type of proxy. NOT INCLUDED in result collection OJB is deployed as a sar, using the following descriptor for the class: primarykey="true" autoincrement="true" sequence-name="UniqueIdentifier" /> The only oddity is that the repository-xml is deployed in the sar, seperate from the ejb deployment (am using sessions beans to access OJB). Am thinking that there may be a classloader issue between the sar and session beans. Think you are right. Try to include the all OJB jars (+ libraries) and your bean jars in the sar. regards, Armin JBoss 3.2.2, OJB from cvs this morning. -Brian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Bizarre Problem running against JBoss...
That did it, though I dislike having to deploy the persistent objects with OJB itself =/ Need to look into JBoss classloading. -Brian On Tuesday, October 21, 2003, at 05:48 PM, Armin Waibel wrote: Hi Brian, On Tue, 21 Oct 2003 17:37:22 -0400, Brian McCallister <[EMAIL PROTECTED]> wrote: 17:29:48,031 INFO [STDOUT] Candidate object [EMAIL PROTECTED] class [com.forthillcompany.eva.model.Profile] is not a subtype of [com.forthillcompany.eva.model.Profile] or any type of proxy. NOT INCLUDED in result collection OJB is deployed as a sar, using the following descriptor for the class: primarykey="true" autoincrement="true" sequence-name="UniqueIdentifier" /> The only oddity is that the repository-xml is deployed in the sar, seperate from the ejb deployment (am using sessions beans to access OJB). Am thinking that there may be a classloader issue between the sar and session beans. Think you are right. Try to include the all OJB jars (+ libraries) and your bean jars in the sar. regards, Armin JBoss 3.2.2, OJB from cvs this morning. -Brian - 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]
help for init problem
Folks, I have an object; Advertiser that has an object; Account. The advertiser also has an AdvertiserState object (created on the fly, not in storage) that represents the status of the advertiser/account combo (the account actually holds the currentStatus as a string, for persistance. I'm using the persistanceBroker version of OJB. I'd like to 'initialize' the advertiser with it's correct AdvertiserState on creation of the advertiser-account object. I note that pb has a class-descriptor attribute: initialization-method: . . . ... etc /> that can get called on creation. My problem is that the account is created seemingly after the advertisement, and the whole object is then assembled. Which means that the account, which has the persistent value of the current object status can't be known when I want it (when the advertiser's init method would get called) to create my on-the-fly AdvertiserState association. Anybody have an idea how I might solve this delemma? Some sort of lazy instatiation? I'm working around it at present, by creating the whole association and then programmatically calling an initialization() routine on the created advertiser. cheers, hba
Re: Bizarre Problem running against JBoss...
Hi Brian, On Tue, 21 Oct 2003 17:37:22 -0400, Brian McCallister <[EMAIL PROTECTED]> wrote: 17:29:48,031 INFO [STDOUT] Candidate object [EMAIL PROTECTED] class [com.forthillcompany.eva.model.Profile] is not a subtype of [com.forthillcompany.eva.model.Profile] or any type of proxy. NOT INCLUDED in result collection OJB is deployed as a sar, using the following descriptor for the class: primarykey="true" autoincrement="true" sequence-name="UniqueIdentifier" /> The only oddity is that the repository-xml is deployed in the sar, seperate from the ejb deployment (am using sessions beans to access OJB). Am thinking that there may be a classloader issue between the sar and session beans. Think you are right. Try to include the all OJB jars (+ libraries) and your bean jars in the sar. regards, Armin JBoss 3.2.2, OJB from cvs this morning. -Brian - 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: check Batchmode problem with DB2 on z/OS with ojb 1.0.rc4
Hi Matthias, On Tue, 21 Oct 2003 23:33:03 +0200, Matthias Roth <[EMAIL PROTECTED]> wrote: Hi does the SequenceManagerHighLowImpl check for batchmode by creating a new broker instance in getSequence(...){ ... PersistenceBrokerFactory.createPersistenceBroker(brokerForSequence.getPBKey( )) ... } I get an db2 jdbc error (ONLY jdbc driver on z/OS) if the first getSequence is called. The error tells that batch mode is not suported. But in the repository.xml file I set batch-mode="false". Have had some body also this problem? Which version do you use? regards, Armin regards Matthias Roth Dipl. Ing. HTL in Wirtschaftsinformatik impart Software Engineering GmbH Chasseralstrasse 13 Postfach CH-3063 Ittigen Phone +41 (0)31 922 39 25 Fax +41 (0)31 922 39 18 EMail mailto:[EMAIL PROTECTED] Homepagehttp://www.impart.ch - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problems with batch-mode=true
Hi, On Tue, 21 Oct 2003 17:13:20 -0400, Bonnie MacKellar <[EMAIL PROTECTED]> wrote: I tried your suggestions, but still get the error. And if I remove the executeBatch call, I also get a ConnectionManager is not in Transaction exception when the transaction is committed. hmm, this should not happen. Please try to set broker.serviceConnectionManager.setBachMode(true); before start the tx. Because the connection was associated with PB instance on PB.beginTx, so setting batch-mode after this may cause problems. I currently made some tests against sapDB without any problems (using CVS head) regards, Armin Is there a way to find out what changes might have been made? Have there been bug reports? I copied my original code from org.apache.ojb.broker.BatchModeTest, by the way, which is where I got the executeBatch call. This is what is shown in that code. And the javadoc definitely implies that you can set the batch mode at runtime. thanks, -Original Message- From: Armin Waibel [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 4:58 PM To: OJB Users List Subject: Re: problems with batch-mode=true Hi Bonnie, Hope I can sheed some light on the 'problem'. > does this mean that you can't set batch mode to "true" > if it is set to "false" in repository_database.xml? yep! I think this behaviour has a big advantage, because it is easy to disable batch-mode by set batch-mode false in repository (if we don't have a bug in handling bach-mode ;-)) ... >> I am trying to insert records in batch mode. Perhaps I don't understand >> how this >> works. Here is my test code to insert 100 customers : >> Assume you have set batch-mode 'true' in repository file. Then you have to enable batch mode for the use PB instance. Try this: >> ConnectionManagerIF conMan = broker.serviceConnectionManager(); >> try >> { >> broker.beginTransaction(); ==>> broker.connectionManager.setBachMode(true); now the PB instance is running in batch-mode till you set false or the PB instance was closed. >> for (int i = 0; i < 100; i++) >> { >> >> CustomerInterface customer = new Customer(); >> customer.setCustomerNumber("100" + i); >> customer.setFirstName("Big"); >> customer.setLastName("Customer"); >> customer.setCustomerName("BadCorporation"); >> customer.setDeleteTag(Boolean.FALSE); >> >> broker.store(customer); >> } >> >> conMan.executeBatch(); think you don't need executeBatch before commit, this will be done at commit. >> broker.commitTransaction(); >> } >> If you still have problems with batch-mode try CVS-head. I think Oleg has checked in some changes (but I'm not sure) regards, Armin >> When I run this with batch-mode="false", it works perfectly, although it >> generates a SELECT and a >> DELETE for every INSERT (which seems rather inefficient). I imagine this >> has something to do with >> an M:N nondecomposed relationship which involves Customer records. >> >> When I run this with batch-mode="true", it fails. I get the following >> exception >> java.lang.IllegalArgumentException: object is not an instance of >> declaring >> class >>at java.lang.reflect.Method.invoke(Native Method) >>at >> org.apache.ojb.broker.util.batch.PreparedStatementInvocationHa ndler.doExec >> ute(Unknown Source) >>at >> org.apache.ojb.broker.util.batch.PreparedStatementInvocationHa ndler.invoke >> (Unknown Source) >>at $Proxy0.doExecute(Unknown Source) >>at >> org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown >> Source) >>at >> org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.execut eBatch(Unkno >> wn Source) >>at >> com.mobius.activebill.dbmigrationutils.CustomerMigration.main( CustomerMigr >> ation.java:68) >> rethrown as org.apache.ojb.broker.accesslayer.OJBBatchUpdateException: >> object is not an instance of declaring class >>at >> org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.execut eBatch(Unkno >> wn Source) >>at >> com.mobius.activebill.dbmigrationutils.CustomerMigration.main( CustomerMigr >> ation.java:68) >> when conMan.executeBatch() is called. >> >> Am I doing something wrong here? I am using rc4, with MSSqlServer and >> JSQLConnect. >> >> thanks, >> Bonnie MacKellar - 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]
Bizarre Problem running against JBoss...
17:29:48,031 INFO [STDOUT] Candidate object [EMAIL PROTECTED] class [com.forthillcompany.eva.model.Profile] is not a subtype of [com.forthillcompany.eva.model.Profile] or any type of proxy. NOT INCLUDED in result collection OJB is deployed as a sar, using the following descriptor for the class: primarykey="true" autoincrement="true" sequence-name="UniqueIdentifier" /> The only oddity is that the repository-xml is deployed in the sar, seperate from the ejb deployment (am using sessions beans to access OJB). Am thinking that there may be a classloader issue between the sar and session beans. JBoss 3.2.2, OJB from cvs this morning. -Brian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
check Batchmode problem with DB2 on z/OS with ojb 1.0.rc4
Hi does the SequenceManagerHighLowImpl check for batchmode by creating a new broker instance in getSequence(...){ ... PersistenceBrokerFactory.createPersistenceBroker(brokerForSequence.getPBKey( )) ... } I get an db2 jdbc error (ONLY jdbc driver on z/OS) if the first getSequence is called. The error tells that batch mode is not suported. But in the repository.xml file I set batch-mode="false". Have had some body also this problem? regards Matthias Roth Dipl. Ing. HTL in Wirtschaftsinformatik impart Software Engineering GmbH Chasseralstrasse 13 Postfach CH-3063 Ittigen Phone +41 (0)31 922 39 25 Fax +41 (0)31 922 39 18 EMail mailto:[EMAIL PROTECTED] Homepagehttp://www.impart.ch
RE: problems with batch-mode=true
I tried your suggestions, but still get the error. And if I remove the executeBatch call, I also get a ConnectionManager is not in Transaction exception when the transaction is committed. Is there a way to find out what changes might have been made? Have there been bug reports? I copied my original code from org.apache.ojb.broker.BatchModeTest, by the way, which is where I got the executeBatch call. This is what is shown in that code. And the javadoc definitely implies that you can set the batch mode at runtime. thanks, > -Original Message- > From: Armin Waibel [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 21, 2003 4:58 PM > To: OJB Users List > Subject: Re: problems with batch-mode=true > > > Hi Bonnie, > > Hope I can sheed some light on the 'problem'. > > > does this mean that you can't set batch mode to "true" > > if it is set to "false" in repository_database.xml? > yep! > I think this behaviour has a big advantage, because it is > easy to disable batch-mode by set batch-mode false in > repository (if we don't have a bug in handling bach-mode ;-)) > > ... > >> I am trying to insert records in batch mode. Perhaps I > don't understand > >> how this > >> works. Here is my test code to insert 100 customers : > >> > > Assume you have set batch-mode 'true' in repository > file. Then you have to enable batch mode for the use > PB instance. > Try this: > > >> ConnectionManagerIF conMan = > broker.serviceConnectionManager(); > >> try > >> { > >> broker.beginTransaction(); > > ==>> broker.connectionManager.setBachMode(true); > now the PB instance is running in batch-mode till you set > false or the PB instance was closed. > >> for (int i = 0; i < 100; i++) > >> { > >> > >> CustomerInterface customer = new Customer(); > >> customer.setCustomerNumber("100" + i); > >> customer.setFirstName("Big"); > >> customer.setLastName("Customer"); > >> customer.setCustomerName("BadCorporation"); > >> customer.setDeleteTag(Boolean.FALSE); > >> > >> broker.store(customer); > >> } > >> > >> conMan.executeBatch(); > think you don't need executeBatch before commit, this will be done > at commit. > >> broker.commitTransaction(); > >> } > >> > > If you still have problems with batch-mode try CVS-head. I think > Oleg has checked in some changes (but I'm not sure) > > regards, > Armin > > >> When I run this with batch-mode="false", it works > perfectly, although it > >> generates a SELECT and a > >> DELETE for every INSERT (which seems rather inefficient). > I imagine this > >> has something to do with > >> an M:N nondecomposed relationship which involves Customer records. > >> > >> When I run this with batch-mode="true", it fails. I get > the following > >> exception > >> java.lang.IllegalArgumentException: object is not an instance of > >> declaring > >> class > >>at java.lang.reflect.Method.invoke(Native Method) > >>at > >> > org.apache.ojb.broker.util.batch.PreparedStatementInvocationHa > ndler.doExec > >> ute(Unknown Source) > >>at > >> > org.apache.ojb.broker.util.batch.PreparedStatementInvocationHa > ndler.invoke > >> (Unknown Source) > >>at $Proxy0.doExecute(Unknown Source) > >>at > >> > org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown > >> Source) > >>at > >> > org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.execut > eBatch(Unkno > >> wn Source) > >>at > >> > com.mobius.activebill.dbmigrationutils.CustomerMigration.main( > CustomerMigr > >> ation.java:68) > >> rethrown as > org.apache.ojb.broker.accesslayer.OJBBatchUpdateException: > >> object is not an instance of declaring class > >>at > >> > org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.execut > eBatch(Unkno > >> wn Source) > >>at > >> > com.mobius.activebill.dbmigrationutils.CustomerMigration.main( > CustomerMigr > >> ation.java:68) > >> when conMan.executeBatch() is called. > >> > >> Am I doing something wrong here? I am using rc4, with > MSSqlServer and > >> JSQLConnect. > >> > >> thanks, > >> Bonnie MacKellar > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >
Re: problems with batch-mode=true
Hi Bonnie, Hope I can sheed some light on the 'problem'. does this mean that you can't set batch mode to "true" if it is set to "false" in repository_database.xml? yep! I think this behaviour has a big advantage, because it is easy to disable batch-mode by set batch-mode false in repository (if we don't have a bug in handling bach-mode ;-)) ... I am trying to insert records in batch mode. Perhaps I don't understand how this works. Here is my test code to insert 100 customers : Assume you have set batch-mode 'true' in repository file. Then you have to enable batch mode for the use PB instance. Try this: ConnectionManagerIF conMan = broker.serviceConnectionManager(); try { broker.beginTransaction(); ==>> broker.connectionManager.setBachMode(true); now the PB instance is running in batch-mode till you set false or the PB instance was closed. for (int i = 0; i < 100; i++) { CustomerInterface customer = new Customer(); customer.setCustomerNumber("100" + i); customer.setFirstName("Big"); customer.setLastName("Customer"); customer.setCustomerName("BadCorporation"); customer.setDeleteTag(Boolean.FALSE); broker.store(customer); } conMan.executeBatch(); think you don't need executeBatch before commit, this will be done at commit. broker.commitTransaction(); } If you still have problems with batch-mode try CVS-head. I think Oleg has checked in some changes (but I'm not sure) regards, Armin When I run this with batch-mode="false", it works perfectly, although it generates a SELECT and a DELETE for every INSERT (which seems rather inefficient). I imagine this has something to do with an M:N nondecomposed relationship which involves Customer records. When I run this with batch-mode="true", it fails. I get the following exception java.lang.IllegalArgumentException: object is not an instance of declaring class at java.lang.reflect.Method.invoke(Native Method) at org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doExec ute(Unknown Source) at org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke (Unknown Source) at $Proxy0.doExecute(Unknown Source) at org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown Source) at org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.executeBatch(Unkno wn Source) at com.mobius.activebill.dbmigrationutils.CustomerMigration.main(CustomerMigr ation.java:68) rethrown as org.apache.ojb.broker.accesslayer.OJBBatchUpdateException: object is not an instance of declaring class at org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.executeBatch(Unkno wn Source) at com.mobius.activebill.dbmigrationutils.CustomerMigration.main(CustomerMigr ation.java:68) when conMan.executeBatch() is called. Am I doing something wrong here? I am using rc4, with MSSqlServer and JSQLConnect. thanks, Bonnie MacKellar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FW: problems with batch-mode=true
Here is a repost of my original problem with batch mode, just in case someone sees it and has a good idea. I don't know if I am just coding this wrong, or if there is a more serious problem. This is a major problem since we need to migrate a lot of records into a database, and would like to do it in batch mode. thanks Bonnie MacKellar software engineer Mobius Management Systems, Inc. [EMAIL PROTECTED] > -Original Message- > From: Bonnie MacKellar > Sent: Monday, October 20, 2003 11:42 AM > To: OJB Users List (E-mail) > Subject: problems with batch-mode=true > > I am trying to insert records in batch mode. Perhaps I don't understand > how this > works. Here is my test code to insert 100 customers : > > ConnectionManagerIF conMan = broker.serviceConnectionManager(); > try > { > broker.beginTransaction(); > > for (int i = 0; i < 100; i++) > { > > CustomerInterface customer = new Customer(); > customer.setCustomerNumber("100" + i); > customer.setFirstName("Big"); > customer.setLastName("Customer"); > customer.setCustomerName("BadCorporation"); > customer.setDeleteTag(Boolean.FALSE); > > broker.store(customer); > } > > conMan.executeBatch(); > broker.commitTransaction(); > } > > When I run this with batch-mode="false", it works perfectly, although it > generates a SELECT and a > DELETE for every INSERT (which seems rather inefficient). I imagine this > has something to do with > an M:N nondecomposed relationship which involves Customer records. > > When I run this with batch-mode="true", it fails. I get the following > exception > java.lang.IllegalArgumentException: object is not an instance of declaring > class > at java.lang.reflect.Method.invoke(Native Method) > at > org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doExec > ute(Unknown Source) > at > org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke > (Unknown Source) > at $Proxy0.doExecute(Unknown Source) > at > org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown > Source) > at > org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.executeBatch(Unkno > wn Source) > at > com.mobius.activebill.dbmigrationutils.CustomerMigration.main(CustomerMigr > ation.java:68) > rethrown as org.apache.ojb.broker.accesslayer.OJBBatchUpdateException: > object is not an instance of declaring class > at > org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.executeBatch(Unkno > wn Source) > at > com.mobius.activebill.dbmigrationutils.CustomerMigration.main(CustomerMigr > ation.java:68) > when conMan.executeBatch() is called. > > Am I doing something wrong here? I am using rc4, with MSSqlServer and > JSQLConnect. > > thanks, > Bonnie MacKellar
does runtime setBatchMode work?
I am using rc4, with MSSqlServer. I posted Friday with a problem while running in batch mode. I still haven't resolved it, and it is a major problem for us. I am hoping someone reads my email and has an idea. While searching through the OJB source to find the cause of my error, I also found this in ConnectionManagerImpl#setBatchMode : public void setBatchMode(boolean mode) { /* arminw: if batch mode was set 'false' in repository, never enable it. There are many users having weird problems when batch mode was enabled behind the scenes */ batchMode = mode && jcd.getBatchMode(); } Does this mean that you can't set batch mode to "true" if it is set to "false" in repository_database.xml? This is certainly the behavior I have seen - only changing the setting in the repository has an effect, and changing it at runtime has no effect. Could someone tell me if this is true or not? thanks, Bonnie MacKellar software engineer Mobius Management Systems, Inc. [EMAIL PROTECTED]
RE: Of topic question -
Joe, To my knowledge this mailing uses ezmlm program http://www.ezmlm.org/ Troy -Original Message- From: Joseph Campbell [mailto:[EMAIL PROTECTED] Sent: October 21, 2003 2:36 PM To: 'OJB Users List' Subject: Of topic question - Does anyone know what listserv software this list uses? Joe -- Dealing with failure is easy: Work hard to improve. Success is also easy to handle: You've solved the wrong problem. Work hard to improve. - Alan Perlis - Joseph Campbell | EMAIL: [EMAIL PROTECTED] Staff Consultant | URL: www.inventa.com Inventa Technologies | PH:(856)914-5200 | PGER: (888)454-0876 - - 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]
Of topic question -
Does anyone know what listserv software this list uses? Joe -- Dealing with failure is easy: Work hard to improve. Success is also easy to handle: You've solved the wrong problem. Work hard to improve. - Alan Perlis - Joseph Campbell | EMAIL: [EMAIL PROTECTED] Staff Consultant | URL: www.inventa.com Inventa Technologies | PH:(856)914-5200 | PGER: (888)454-0876 - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Inheritance mapping, storing new object associated with pre-e xistingsuper object
Gerhard, Sorry. I should have said "inclusive" instead of "non-exclusive". Just for the record, some terms exist even though they may have been removed from the current, popular methodologies and languages. Prior to design, when you aren't constrained by a particular language (modeling or programming) or the particular tools employed, the most natural way to represent this is to use inclusive subclasses. A / \ {inclusive} B C This is typically represented using multiple inheritance when the modeling language doesn't support inclusive subclassing. However, this is only due to the introduction of constraints in the modeling language. A / \ B C \ / D However, as you said, Java does not support multiple inheritance (a constraint introduced by the language) so we can't do that. Again, in our case, all of the classes are concrete classes. Using your suggestion, we could add to your model a Person class that implements I_Person that also has an optional reference to a User instance and an optional reference to a Driver instance. Is that how you would have done it? Does this introduce any problems for OJB? Later. Mitch -Original Message- From: Gerhard Grosse [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 9:50 AM To: [EMAIL PROTECTED] Subject: Re: Inheritance mapping, storing new object associated with pre-e xistingsuper object On Tue, 21 Oct 2003 08:55:02 -0500, Mitch Norby <[EMAIL PROTECTED]> wrote: Hi Mitch, How would you model this in Java? Wouldn't you just have two objects, one of type User and another of type Driver, which happen to have identical Person attributes? If you wanted to change a Person attribute on your User instance, you'd have to do the same on the Driver instance to keep those two in sync. Java has no built in support for this scenario, no matter how you call it. (Hmmh, does the term non-exclusive subclassing really exist?) IMO the most natural approach to model this situation is using something like the GOF Decorator pattern, where basically User and Driver implement an I_Person interface and can share a reference to a Person instance, to which they delegate all calls of I_Person methods. This is easily mapped in OJB as a 1->1 reference from User to Person and Driver to Person. Cheers, Gerhard >We have the same issue. In our case, the classes are Person, User, and >Driver. All of these are concrete classes. However, this has nothing to do >with multiple inheritance. The subclasses do not inherit from multiple >superclasses. This is a case of non-exclusive subclassing. > >As an example, a Person can be simply a Person or a User or a Driver or a >User who is also a Driver. > >Due to (our understanding of) limitations in OJB we decided to create a 1:1 >relationship from Person to DriverInformation in order to handle this >circumstance. > >If we have misunderstood OJB, please let me know. > >Later. >Mitch > >-Original Message- >From: Gerhard Grosse [mailto:[EMAIL PROTECTED] >Sent: Tuesday, October 21, 2003 6:55 AM >To: [EMAIL PROTECTED] >Subject: Re: Inheritance mapping, storing new object associated with >pre-existingsuper object > > >Hi Matt, > >Excuse me to jump in here, but I believe what you have in mind is not >possible in Java and even less with OJB. If your B1 and B2 instance >should 'contain' the same A instance as base class, they are identical >objects, which would require a language that supports multiple >inheritance (and virtual base classes). You could do that in in C++ >but not in Java. > >What you can do in Java (and OJB) is declare an interface I_A >implemented by A, B1 and B2. I_A just declares all public methods of A >and in B1 and B2 you implement this interface by delegation. That is >in B1 and B2 you have a reference to a A object and all I_A methods on >B1 and B2 are just routed to this reference. That way distinct >instances of B1 and B2 can easily share a common A reference. > >HTH, >Gerhard > >On Tue, 21 Oct 2003 00:27:02 -0400, Matt Mastrangelo ><[EMAIL PROTECTED]> wrote: > >>Chris, >> >>Just to clarify -- are you saying it's not possible to create the User >>instance without also creating a new Person instance? Maybe my example >>was not too clear. Let me re-explain: >> >>I have a base class A with two subclasses, B1 and B2. I have already >>created an instance of B1 and stored it to the database, which means >>that an A record and a B1 record were inserted. I now want to create an >>instance of B2 that extends from the same A record as B1. Is this >possible? >> >>Thanks again. >> >>Matt >> >>[EMAIL PROTECTED] wrote: >> >>>Matt, >>> >>>I believe since the Person and Student object exist it will set there >>>values to null except the personId. Because in the User instance you are >>>storing allthe other fields are null (if you set them to null when you >>>declare them) except the loginName. So, ojb will know that person and >>>student 001 exist and will do and update instead of an insert.
RE : Very bad performance with big Tables
My only experience is that we have longer time execution with RC4 under MSSQL than before in RC3... I don't investigate on it already -Message d'origine- De : Axel Hohaus [mailto:[EMAIL PROTECTED] Envoyé : mardi 21 octobre 2003 16:59 À : [EMAIL PROTECTED] Objet : Re: Very bad performance with big Tables Hi Charles, we also checked the Opta2000 jdbc driver. No enhancement. OJB tells the jdbc driver to generate a parameterized sql statement instead of an 'simple' sql statement. These parameterized sql statement cause the long duration of the execution in my opinion. It is not an spezial problem of jdbc or ojb but maybe a ms sqlserver problem. Has anyone experience with huge tables and sql server in this matter? Is this an problem of my environmet or does such things also occur for example in an oracle environment. with kind regards Markus Denkinger - 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: Very bad performance with big Tables
Hi Charles, we also checked the Opta2000 jdbc driver. No enhancement. OJB tells the jdbc driver to generate a parameterized sql statement instead of an 'simple' sql statement. These parameterized sql statement cause the long duration of the execution in my opinion. It is not an spezial problem of jdbc or ojb but maybe a ms sqlserver problem. Has anyone experience with huge tables and sql server in this matter? Is this an problem of my environmet or does such things also occur for example in an oracle environment. with kind regards Markus Denkinger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Strategies to avoid RI constraint violations?
Hi, I just wonder what strategies others employ to avoid RI constraint violations. It seems to me that these inevitably occur in larger transactions on complex object models. Any hints other than turning RI checking off altogether? (I'm short before doing so...) Thanks, Gerhard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Inheritance mapping, storing new object associated with pre-e xistingsuper object
On Tue, 21 Oct 2003 08:55:02 -0500, Mitch Norby <[EMAIL PROTECTED]> wrote: Hi Mitch, How would you model this in Java? Wouldn't you just have two objects, one of type User and another of type Driver, which happen to have identical Person attributes? If you wanted to change a Person attribute on your User instance, you'd have to do the same on the Driver instance to keep those two in sync. Java has no built in support for this scenario, no matter how you call it. (Hmmh, does the term non-exclusive subclassing really exist?) IMO the most natural approach to model this situation is using something like the GOF Decorator pattern, where basically User and Driver implement an I_Person interface and can share a reference to a Person instance, to which they delegate all calls of I_Person methods. This is easily mapped in OJB as a 1->1 reference from User to Person and Driver to Person. Cheers, Gerhard >We have the same issue. In our case, the classes are Person, User, and >Driver. All of these are concrete classes. However, this has nothing to do >with multiple inheritance. The subclasses do not inherit from multiple >superclasses. This is a case of non-exclusive subclassing. > >As an example, a Person can be simply a Person or a User or a Driver or a >User who is also a Driver. > >Due to (our understanding of) limitations in OJB we decided to create a 1:1 >relationship from Person to DriverInformation in order to handle this >circumstance. > >If we have misunderstood OJB, please let me know. > >Later. >Mitch > >-Original Message- >From: Gerhard Grosse [mailto:[EMAIL PROTECTED] >Sent: Tuesday, October 21, 2003 6:55 AM >To: [EMAIL PROTECTED] >Subject: Re: Inheritance mapping, storing new object associated with >pre-existingsuper object > > >Hi Matt, > >Excuse me to jump in here, but I believe what you have in mind is not >possible in Java and even less with OJB. If your B1 and B2 instance >should 'contain' the same A instance as base class, they are identical >objects, which would require a language that supports multiple >inheritance (and virtual base classes). You could do that in in C++ >but not in Java. > >What you can do in Java (and OJB) is declare an interface I_A >implemented by A, B1 and B2. I_A just declares all public methods of A >and in B1 and B2 you implement this interface by delegation. That is >in B1 and B2 you have a reference to a A object and all I_A methods on >B1 and B2 are just routed to this reference. That way distinct >instances of B1 and B2 can easily share a common A reference. > >HTH, >Gerhard > >On Tue, 21 Oct 2003 00:27:02 -0400, Matt Mastrangelo ><[EMAIL PROTECTED]> wrote: > >>Chris, >> >>Just to clarify -- are you saying it's not possible to create the User >>instance without also creating a new Person instance? Maybe my example >>was not too clear. Let me re-explain: >> >>I have a base class A with two subclasses, B1 and B2. I have already >>created an instance of B1 and stored it to the database, which means >>that an A record and a B1 record were inserted. I now want to create an >>instance of B2 that extends from the same A record as B1. Is this >possible? >> >>Thanks again. >> >>Matt >> >>[EMAIL PROTECTED] wrote: >> >>>Matt, >>> >>>I believe since the Person and Student object exist it will set there >>>values to null except the personId. Because in the User instance you are >>>storing allthe other fields are null (if you set them to null when you >>>declare them) except the loginName. So, ojb will know that person and >>>student 001 exist and will do and update instead of an insert. >>> >>>You should create them on the first store. Or do not have user extend >>>Student, instead have a 1:1 relationship. Depends on your requirments i >>>guess. >>> >>>-chris worley >>> >>> >>> I'm trying to figure out how to store a new persisted object that extends a pre-existing object. For example, I have 3 classes: Person, Student, and User. Student and User extend Person. A Student object already exists, and I now want to create a User object that inherits from the same Person as the Student object. Is this possible? Here's a code example: User user = new User(); user.setLoginName("matt"); user.setPersonOid("001"); // A pre-existing person broker.beginTransaction(); broker.store(user); broker.commitTransaction(); The result of the above code is a NEW empty person object being created with a newly generated OID (via a sequence). How can I associate the new User with a pre-existing Person? Thanks again. Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>>- >>>To unsubscribe, e-mail: [EMAIL PROTECTED] >>>For additiona
Re: Inheritance mapping, storing new object associated with pre-existingsuper object
Matt, Here is what i suggest you do, if this fits your requirments. In this example Student extends Person and Person has a 1:M relationship with UserLogin. You can change it to 1:1 relation ship by makeint UserLogin.personId the PK instead of UserLogin.userLoginId. This way all people can have logins. --- repository --- end repository --- After creating your Person or Student this is how you can store your UserLogin. You will need to query for the person first, you must set both userLogin.person and userLogin.personId or person id will be null. --- how to store user - // get your person if youhave not already OPerson person = new OPerson(); person.setPersonId("001"); person = (OPerson) getPersistenceBroker().getObjectByQuery(new QueryByCriteria(person)); // now create the login OUserLogin userLogin = new OUserLogin(); userLogin.setUserLoginId(userLoginId); // make sure user does not exist, it looks better than an SQL exception OUserLogin checkUserLogin = (OUserLogin)getPersistenceBroker().getObjectByQuery(new QueryByCriteria(userLogin)); if(checkUserLogin != null) { throw new OCommandException( "User login '" + userLoginId + "' already exist."); } userLogin.setPassword(password); userLogin.setPerson(person); userLogin.setPersonId(person.getPersonId()); getAPersistenceBroker().store(userLogin); end how to store user -chris worley Hi Gerhard, I'm not saying the B1 and B2 instances should extend the same instance of A, but that they should be materialized from the same A record in the database. B1 and B2 would have to be different objects obviously. I think this could be quite possible in OJB. But let me ask the question a different way - suppose I have an instance of A that already exists. Now I want to create a B1 instance that is associated with the already existing A instance. So I don't want a new A record to be created, only new B1 record that "extends" the pre-existing A record. Is that possible? Thank you for your input. Matt Gerhard Grosse wrote: Hi Matt, Excuse me to jump in here, but I believe what you have in mind is not possible in Java and even less with OJB. If your B1 and B2 instance should 'contain' the same A instance as base class, they are identical objects, which would require a language that supports multiple inheritance (and virtual base classes). You could do that in in C++ but not in Java. What you can do in Java (and OJB) is declare an interface I_A implemented by A, B1 and B2. I_A just declares all public methods of A and in B1 and B2 you implement this interface by delegation. That is in B1 and B2 you have a reference to a A object and all I_A methods on B1 and B2 are just routed to this reference. That way distinct instances of B1 and B2 can easily share a common A reference. HTH, Gerhard On Tue, 21 Oct 2003 00:27:02 -0400, Matt Mastrangelo <[EMAIL PROTECTED]> wrote: Chris, Just to clarify -- are you saying it's not possible to create the User instance without also creating a new Person instance? Maybe my example was not too clear. Let me re-explain: I have a base class A with two subclasses, B1 and B2. I have already created an instance of B1 and stored it to the database, which means that an A record and a B1 record were inserted. I now want to create an instance of B2 that extends from the same A record as B1. Is this possible? Thanks again. Matt [EMAIL PROTECTED] wrote: Matt, I believe since the Person and Student object exist it will set there values to null except the personId. Because in the User instance you are storing allthe other fields are null (if you set them to null when you declare them) except the loginName. So, ojb will know that person and student 001 exist and will do and update instead of an insert. You should create them on the first store. Or do not have user extend Student, instead have a 1:1 relationship. Depends on your requirments i guess. -chris worley I'm trying to figure out how to store a new persisted object that extends a pre-existing object. For example, I have 3 classes: Person, Student, and User. Student and User extend Person. A Student object already exists, and I now want to create a User object that inherits from the same Person as the Student object. Is this possible? Here's a code example: User user = new User(); user.setLoginName("matt"); user.setPersonOid("001"); // A pre-existing person broker.beginTransaction(); broker.store(user); broker.commitTransaction(); The result of the above code is a NEW empty person object being created with a newly generated OID (via a sequence). How can I associate the new User with a pre-existing Person? Thanks again. Matt
Re: Inheritance mapping, storing new object associated with pre-existingsuper object
On Tue, 21 Oct 2003 09:45:29 -0400, Matt Mastrangelo <[EMAIL PROTECTED]> wrote: Hi Matt, >Hi Gerhard, > >I'm not saying the B1 and B2 instances should extend the same instance >of A, but that they should be materialized from the same A record in the >database. B1 and B2 would have to be different objects obviously. I >think this could be quite possible in OJB. I think OJB's concept of object identity would require these objects to be identical, because the identity of an persistent object is defined by its primary key and the top-level class of the extent. (There have been discussions whether this is the best approach, though.) >But let me ask the question a different way - suppose I have an instance >of A that already exists. Now I want to create a B1 instance that is >associated with the already existing A instance. So I don't want a new >A record to be created, only new B1 record that "extends" the >pre-existing A record. Is that possible? That should be possible. But probably you'd have to manually copy all attributes (including PK!) from the existing A object to the new B1 object. Then PB.store(B1) should effectively change the ojbConcreteClass of the existing record. Cheers, Gerhard > >Thank you for your input. > >Matt > >Gerhard Grosse wrote: > >>Hi Matt, >> >>Excuse me to jump in here, but I believe what you have in mind is not >>possible in Java and even less with OJB. If your B1 and B2 instance >>should 'contain' the same A instance as base class, they are identical >>objects, which would require a language that supports multiple >>inheritance (and virtual base classes). You could do that in in C++ >>but not in Java. >> >>What you can do in Java (and OJB) is declare an interface I_A >>implemented by A, B1 and B2. I_A just declares all public methods of A >>and in B1 and B2 you implement this interface by delegation. That is >>in B1 and B2 you have a reference to a A object and all I_A methods on >>B1 and B2 are just routed to this reference. That way distinct >>instances of B1 and B2 can easily share a common A reference. >> >>HTH, >>Gerhard >> >>On Tue, 21 Oct 2003 00:27:02 -0400, Matt Mastrangelo >><[EMAIL PROTECTED]> wrote: >> >> >> >>>Chris, >>> >>>Just to clarify -- are you saying it's not possible to create the User >>>instance without also creating a new Person instance? Maybe my example >>>was not too clear. Let me re-explain: >>> >>>I have a base class A with two subclasses, B1 and B2. I have already >>>created an instance of B1 and stored it to the database, which means >>>that an A record and a B1 record were inserted. I now want to create an >>>instance of B2 that extends from the same A record as B1. Is this possible? >>> >>>Thanks again. >>> >>>Matt >>> >>>[EMAIL PROTECTED] wrote: >>> >>> >>> Matt, I believe since the Person and Student object exist it will set there values to null except the personId. Because in the User instance you are storing allthe other fields are null (if you set them to null when you declare them) except the loginName. So, ojb will know that person and student 001 exist and will do and update instead of an insert. You should create them on the first store. Or do not have user extend Student, instead have a 1:1 relationship. Depends on your requirments i guess. -chris worley >I'm trying to figure out how to store a new persisted object that >extends a pre-existing object. > >For example, I have 3 classes: Person, Student, and User. Student and >User extend Person. A Student object already exists, and I now want to >create a User object that inherits from the same Person as the Student >object. Is this possible? Here's a code example: > >User user = new User(); >user.setLoginName("matt"); >user.setPersonOid("001"); // A pre-existing person > >broker.beginTransaction(); >broker.store(user); >broker.commitTransaction(); > >The result of the above code is a NEW empty person object being created >with a newly generated OID (via a sequence). How can I associate the >new User with a pre-existing Person? > >Thanks again. > >Matt > > > >- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >>- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> - To unsubscr
AW: Very bad performance with big Tables
Hi Charles, thanks for your quick answer. Primary key and indices setted correctly. It's correct, that we are using the Microsoft SQL 2000 JDBC driver. We have made experiences with jtds and the performance of the Microsoft JDBC driver was in many cases better than jdts. We have a look for your link. Axel > -Ursprüngliche Nachricht- > Von: Charles Anthony [mailto:[EMAIL PROTECTED] > Gesendet: Dienstag, 21. Oktober 2003 15:56 > An: 'OJB Users List' > Betreff: RE: Very bad performance with big Tables > > > Hi Axel, > > This may be a completely stupid question, and irrelevant, but > do you have an index created on column hisOID ? > If not, Is hisOID actually marked as being a primary key > (i.e. does it have a primary key constraint) ? > > The syntax you specify in the first example is *not* > generated by OJB, actually, but by the JDBC driver. OJB > creates a PreparedStatement - which in most cases is more > perfomant that executing a SQL string directly. All the @P1 > @P1 etc bits are generated by the JDBC driver (which I am > assuming is the Microsoft JDBC driver). > > Finally, have you tried using a different JDBC driver ? My tests > http://www.mail-archive.com/[EMAIL PROTECTED]/msg03163.html > show that the MS driver is not very good... I'd test using a > different driver to see if that makes a difference. > > Cheers, > Charles. > > > > -Original Message- > > From: Axel Hohaus [mailto:[EMAIL PROTECTED] > > Sent: 21 October 2003 14:51 > > To: [EMAIL PROTECTED] > > Subject: Very bad performance with big Tables > > > > > > I have a problem with big tables and MS SQL Server. The > table has more > > than 5 million records. Select and Update statements are > very slow. I > > think the problem is the statement with parameters > generated by ojb. > > The statement with the parameter syntax runs almost 6 > seconds, without > > it just takes mills. > > > > Has someone also recognized is problem. > > Does someone knows why this syntax is so slow and has some > suggestions > > how to fix it. Is there an easy way to change the statement > > generation, > > if there are no other advices. > > > > Example > > > > First takes 6 sec > > > > exec sp_executesql N'UPDATE History SET > > [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],hisLa > > stModifier > > [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED] > > 7,hisAttac > > [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],hisO > > [EMAIL PROTECTED] > > 11 WHERE hisOID = @P12 ', N'@P1 datetime ,@P2 nvarchar(4000) ,@P3 > > datetime ,@P4 nvarchar(4000) ,@P5 nvarchar(4000) ,@P6 > nvarchar(4000) > > ,@P7 datetime ,@P8 nvarchar(4000) ,@P9 nvarchar(4000) ,@P10 > > nvarchar(4000) ,@P11 nvarchar(4000) ,@P12 nvarchar(4000) ', > > 'Jul 28 2003 > > 5:17:32:000PM', N'ibrahimk', 'Okt 20 2003 5:29:29:777PM', > N'SYSTEM', > > N'SV: xxx', N'', 'Jul 28 2003 5:17:31:000PM', NULL, N'90', N'1080', > > N'5CCFCCE8-B144-11D7-A860-0007E90F2D57', > > N'FC7C1593-9D39-4D21-9E02-B86F91DCCDD7' > > > > Second takes just mills > > > > exec sp_executesql N'UPDATE History SET > hisLockTimestamp=''Jul 28 2003 > > > 5:17:31:000PM'',hisLockUser=''ibrahimk'',hisLastModified=''Jul 28 2003 > > 5:17:31:000PM'',hisLastModifier=''SYSTEM'',hisShortDescription=''SV: > > xxx'',hisDescription=,hisCreation=''Jul 28 2003 > > 5:17:31:000PM'',hisAttachmentOID=,hisOrderStatusOID=''90'' > > ,hisHistor > > > yTypeOID=''1080'',hisOrderOID=''5CCFCCE8-B144-11D7-A860-0007E90F2D57'' > > WHERE hisOID = ''FC7C1593-9D39-4D21-9E02-B86F91DCCDD7''' > > > > with kind regards > > > > Markus Denkinger > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > This email and any attachments are strictly confidential and > are intended solely for the addressee. If you are not the > intended recipient you must not disclose, forward, copy or > take any action in reliance on this message or its > attachments. If you have received this email in error please > notify the sender as soon as possible and delete it from your > computer systems. Any views or opinions presented are solely > those of the author and do not necessarily reflect those of > HPD Software Limited or its affiliates. > > At present the integrity of email across the internet cannot > be guaranteed and messages sent via this medium are > potentially at risk. All liability is excluded to the extent > permitted by law for any claims arising as a re- sult of the > use of this medium to transmit information by or to > HPD Software Limited or its affiliates. > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - To un
RE: Inheritance mapping, storing new object associated with pre-existingsuper object
I know it is possible when A and B1 are mapped to one table. Not sure about when they are mapped to two tables. I would hope both would work since the only difference is in the mapping layer. When they are mapped to one table... 1) Grab the A instance. 2) Create an instance of B1 and copy all attributes from the A instance. 3) Fill in B1 attributes. 4) Store. Later. Mitch -Original Message- From: Matt Mastrangelo [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 8:45 AM To: OJB Users List Subject: Re: Inheritance mapping, storing new object associated with pre-existingsuper object Hi Gerhard, I'm not saying the B1 and B2 instances should extend the same instance of A, but that they should be materialized from the same A record in the database. B1 and B2 would have to be different objects obviously. I think this could be quite possible in OJB. But let me ask the question a different way - suppose I have an instance of A that already exists. Now I want to create a B1 instance that is associated with the already existing A instance. So I don't want a new A record to be created, only new B1 record that "extends" the pre-existing A record. Is that possible? Thank you for your input. Matt Gerhard Grosse wrote: >Hi Matt, > >Excuse me to jump in here, but I believe what you have in mind is not >possible in Java and even less with OJB. If your B1 and B2 instance >should 'contain' the same A instance as base class, they are identical >objects, which would require a language that supports multiple >inheritance (and virtual base classes). You could do that in in C++ >but not in Java. > >What you can do in Java (and OJB) is declare an interface I_A >implemented by A, B1 and B2. I_A just declares all public methods of A >and in B1 and B2 you implement this interface by delegation. That is >in B1 and B2 you have a reference to a A object and all I_A methods on >B1 and B2 are just routed to this reference. That way distinct >instances of B1 and B2 can easily share a common A reference. > >HTH, >Gerhard > >On Tue, 21 Oct 2003 00:27:02 -0400, Matt Mastrangelo ><[EMAIL PROTECTED]> wrote: > > > >>Chris, >> >>Just to clarify -- are you saying it's not possible to create the User >>instance without also creating a new Person instance? Maybe my example >>was not too clear. Let me re-explain: >> >>I have a base class A with two subclasses, B1 and B2. I have already >>created an instance of B1 and stored it to the database, which means >>that an A record and a B1 record were inserted. I now want to create an >>instance of B2 that extends from the same A record as B1. Is this possible? >> >>Thanks again. >> >>Matt >> >>[EMAIL PROTECTED] wrote: >> >> >> >>>Matt, >>> >>>I believe since the Person and Student object exist it will set there >>>values to null except the personId. Because in the User instance you are >>>storing allthe other fields are null (if you set them to null when you >>>declare them) except the loginName. So, ojb will know that person and >>>student 001 exist and will do and update instead of an insert. >>> >>>You should create them on the first store. Or do not have user extend >>>Student, instead have a 1:1 relationship. Depends on your requirments i >>>guess. >>> >>>-chris worley >>> >>> >>> >>> >>> I'm trying to figure out how to store a new persisted object that extends a pre-existing object. For example, I have 3 classes: Person, Student, and User. Student and User extend Person. A Student object already exists, and I now want to create a User object that inherits from the same Person as the Student object. Is this possible? Here's a code example: User user = new User(); user.setLoginName("matt"); user.setPersonOid("001"); // A pre-existing person broker.beginTransaction(); broker.store(user); broker.commitTransaction(); The result of the above code is a NEW empty person object being created with a newly generated OID (via a sequence). How can I associate the new User with a pre-existing Person? Thanks again. Matt - 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] > > > > -- Matt Mastrangelo X2 Development Corporation 781-740-2679 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECT
RE: Very bad performance with big Tables
Hi Axel, This may be a completely stupid question, and irrelevant, but do you have an index created on column hisOID ? If not, Is hisOID actually marked as being a primary key (i.e. does it have a primary key constraint) ? The syntax you specify in the first example is *not* generated by OJB, actually, but by the JDBC driver. OJB creates a PreparedStatement - which in most cases is more perfomant that executing a SQL string directly. All the @P1 @P1 etc bits are generated by the JDBC driver (which I am assuming is the Microsoft JDBC driver). Finally, have you tried using a different JDBC driver ? My tests http://www.mail-archive.com/[EMAIL PROTECTED]/msg03163.html show that the MS driver is not very good... I'd test using a different driver to see if that makes a difference. Cheers, Charles. > -Original Message- > From: Axel Hohaus [mailto:[EMAIL PROTECTED] > Sent: 21 October 2003 14:51 > To: [EMAIL PROTECTED] > Subject: Very bad performance with big Tables > > > I have a problem with big tables and MS SQL Server. The table has more > than 5 million records. Select and Update statements are very slow. I > think the problem is the statement with parameters generated > by ojb. The > statement with the parameter syntax runs almost 6 seconds, without it > just takes mills. > > Has someone also recognized is problem. > Does someone knows why this syntax is so slow and has some suggestions > how to fix it. Is there an easy way to change the statement > generation, > if there are no other advices. > > Example > > First takes 6 sec > > exec sp_executesql N'UPDATE History SET > [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],hisLa > stModifier > [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED] > 7,hisAttac > [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],hisO > [EMAIL PROTECTED] > 11 WHERE hisOID = @P12 ', N'@P1 datetime ,@P2 nvarchar(4000) ,@P3 > datetime ,@P4 nvarchar(4000) ,@P5 nvarchar(4000) ,@P6 nvarchar(4000) > ,@P7 datetime ,@P8 nvarchar(4000) ,@P9 nvarchar(4000) ,@P10 > nvarchar(4000) ,@P11 nvarchar(4000) ,@P12 nvarchar(4000) ', > 'Jul 28 2003 > 5:17:32:000PM', N'ibrahimk', 'Okt 20 2003 5:29:29:777PM', N'SYSTEM', > N'SV: xxx', N'', 'Jul 28 2003 5:17:31:000PM', NULL, N'90', N'1080', > N'5CCFCCE8-B144-11D7-A860-0007E90F2D57', > N'FC7C1593-9D39-4D21-9E02-B86F91DCCDD7' > > Second takes just mills > > exec sp_executesql N'UPDATE History SET hisLockTimestamp=''Jul 28 2003 > 5:17:31:000PM'',hisLockUser=''ibrahimk'',hisLastModified=''Jul 28 2003 > 5:17:31:000PM'',hisLastModifier=''SYSTEM'',hisShortDescription=''SV: > xxx'',hisDescription=,hisCreation=''Jul 28 2003 > 5:17:31:000PM'',hisAttachmentOID=,hisOrderStatusOID=''90'' > ,hisHistor > yTypeOID=''1080'',hisOrderOID=''5CCFCCE8-B144-11D7-A860-0007E90F2D57'' > WHERE hisOID = ''FC7C1593-9D39-4D21-9E02-B86F91DCCDD7''' > > with kind regards > > Markus Denkinger > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > This email and any attachments are strictly confidential and are intended solely for the addressee. If you are not the intended recipient you must not disclose, forward, copy or take any action in reliance on this message or its attachments. If you have received this email in error please notify the sender as soon as possible and delete it from your computer systems. Any views or opinions presented are solely those of the author and do not necessarily reflect those of HPD Software Limited or its affiliates. At present the integrity of email across the internet cannot be guaranteed and messages sent via this medium are potentially at risk. All liability is excluded to the extent permitted by law for any claims arising as a re- sult of the use of this medium to transmit information by or to HPD Software Limited or its affiliates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Inheritance mapping, storing new object associated with pre-e xistingsuper object
We have the same issue. In our case, the classes are Person, User, and Driver. All of these are concrete classes. However, this has nothing to do with multiple inheritance. The subclasses do not inherit from multiple superclasses. This is a case of non-exclusive subclassing. As an example, a Person can be simply a Person or a User or a Driver or a User who is also a Driver. Due to (our understanding of) limitations in OJB we decided to create a 1:1 relationship from Person to DriverInformation in order to handle this circumstance. If we have misunderstood OJB, please let me know. Later. Mitch -Original Message- From: Gerhard Grosse [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 6:55 AM To: [EMAIL PROTECTED] Subject: Re: Inheritance mapping, storing new object associated with pre-existingsuper object Hi Matt, Excuse me to jump in here, but I believe what you have in mind is not possible in Java and even less with OJB. If your B1 and B2 instance should 'contain' the same A instance as base class, they are identical objects, which would require a language that supports multiple inheritance (and virtual base classes). You could do that in in C++ but not in Java. What you can do in Java (and OJB) is declare an interface I_A implemented by A, B1 and B2. I_A just declares all public methods of A and in B1 and B2 you implement this interface by delegation. That is in B1 and B2 you have a reference to a A object and all I_A methods on B1 and B2 are just routed to this reference. That way distinct instances of B1 and B2 can easily share a common A reference. HTH, Gerhard On Tue, 21 Oct 2003 00:27:02 -0400, Matt Mastrangelo <[EMAIL PROTECTED]> wrote: >Chris, > >Just to clarify -- are you saying it's not possible to create the User >instance without also creating a new Person instance? Maybe my example >was not too clear. Let me re-explain: > >I have a base class A with two subclasses, B1 and B2. I have already >created an instance of B1 and stored it to the database, which means >that an A record and a B1 record were inserted. I now want to create an >instance of B2 that extends from the same A record as B1. Is this possible? > >Thanks again. > >Matt > >[EMAIL PROTECTED] wrote: > >>Matt, >> >>I believe since the Person and Student object exist it will set there >>values to null except the personId. Because in the User instance you are >>storing allthe other fields are null (if you set them to null when you >>declare them) except the loginName. So, ojb will know that person and >>student 001 exist and will do and update instead of an insert. >> >>You should create them on the first store. Or do not have user extend >>Student, instead have a 1:1 relationship. Depends on your requirments i >>guess. >> >>-chris worley >> >> >> >>>I'm trying to figure out how to store a new persisted object that >>>extends a pre-existing object. >>> >>>For example, I have 3 classes: Person, Student, and User. Student and >>>User extend Person. A Student object already exists, and I now want to >>>create a User object that inherits from the same Person as the Student >>>object. Is this possible? Here's a code example: >>> >>>User user = new User(); >>>user.setLoginName("matt"); >>>user.setPersonOid("001"); // A pre-existing person >>> >>>broker.beginTransaction(); >>>broker.store(user); >>>broker.commitTransaction(); >>> >>>The result of the above code is a NEW empty person object being created >>>with a newly generated OID (via a sequence). How can I associate the >>>new User with a pre-existing Person? >>> >>>Thanks again. >>> >>>Matt >>> >>> >>> >>>- >>>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] -- The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message.
Very bad performance with big Tables
I have a problem with big tables and MS SQL Server. The table has more than 5 million records. Select and Update statements are very slow. I think the problem is the statement with parameters generated by ojb. The statement with the parameter syntax runs almost 6 seconds, without it just takes mills. Has someone also recognized is problem. Does someone knows why this syntax is so slow and has some suggestions how to fix it. Is there an easy way to change the statement generation, if there are no other advices. Example First takes 6 sec exec sp_executesql N'UPDATE History SET [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],hisLastModifier [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],hisAttac [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED] 11 WHERE hisOID = @P12 ', N'@P1 datetime ,@P2 nvarchar(4000) ,@P3 datetime ,@P4 nvarchar(4000) ,@P5 nvarchar(4000) ,@P6 nvarchar(4000) ,@P7 datetime ,@P8 nvarchar(4000) ,@P9 nvarchar(4000) ,@P10 nvarchar(4000) ,@P11 nvarchar(4000) ,@P12 nvarchar(4000) ', 'Jul 28 2003 5:17:32:000PM', N'ibrahimk', 'Okt 20 2003 5:29:29:777PM', N'SYSTEM', N'SV: xxx', N'', 'Jul 28 2003 5:17:31:000PM', NULL, N'90', N'1080', N'5CCFCCE8-B144-11D7-A860-0007E90F2D57', N'FC7C1593-9D39-4D21-9E02-B86F91DCCDD7' Second takes just mills exec sp_executesql N'UPDATE History SET hisLockTimestamp=''Jul 28 2003 5:17:31:000PM'',hisLockUser=''ibrahimk'',hisLastModified=''Jul 28 2003 5:17:31:000PM'',hisLastModifier=''SYSTEM'',hisShortDescription=''SV: xxx'',hisDescription=,hisCreation=''Jul 28 2003 5:17:31:000PM'',hisAttachmentOID=,hisOrderStatusOID=''90'',hisHistor yTypeOID=''1080'',hisOrderOID=''5CCFCCE8-B144-11D7-A860-0007E90F2D57'' WHERE hisOID = ''FC7C1593-9D39-4D21-9E02-B86F91DCCDD7''' with kind regards Markus Denkinger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Looking for advice on how to set up Xdoclet Ojb modules
Thomas, Thanks for the advice it is really apreciated I am very new to ASF/open source software tools (except of courtse apache web server). There is a lot of new literature coming out next month about open source tools such as junit and xdoclet but until then I guess I will be struggling a bit. At least I finally got the hang of ant. Troy -Original Message- From: Thomas Dudziak [mailto:[EMAIL PROTECTED] Sent: October 21, 2003 4:48 AM To: OJB Users List Subject: RE: Looking for advice on how to set up Xdoclet Ojb modules You don't have to use the OJB CVS version, you only should use the xdoclet module from the CVS (its newer than the one with rc4). If you use the module with a stable release, then it might be that some generated attributes in the XML descriptor are not recognized by OJB, but I think this is only the case with versions older than rc4. I'd strongly advise you to use the xdoclet jars supplied with the xdoclet ojb module, or to use the CVS HEAD from xdoclet. First, the xdoclet CVS HEAD is quite stable (at least concerning the xdoclet core and the major modules like EJB), and secondly there might have been API changes since the last stable release. It might work with the 1.2b3 release , but I didn't test it (I know however that it does not work with 1.2b2 and older). Tom - 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: Inheritance mapping, storing new object associated with pre-existingsuper object
Hi Gerhard, I'm not saying the B1 and B2 instances should extend the same instance of A, but that they should be materialized from the same A record in the database. B1 and B2 would have to be different objects obviously. I think this could be quite possible in OJB. But let me ask the question a different way - suppose I have an instance of A that already exists. Now I want to create a B1 instance that is associated with the already existing A instance. So I don't want a new A record to be created, only new B1 record that "extends" the pre-existing A record. Is that possible? Thank you for your input. Matt Gerhard Grosse wrote: Hi Matt, Excuse me to jump in here, but I believe what you have in mind is not possible in Java and even less with OJB. If your B1 and B2 instance should 'contain' the same A instance as base class, they are identical objects, which would require a language that supports multiple inheritance (and virtual base classes). You could do that in in C++ but not in Java. What you can do in Java (and OJB) is declare an interface I_A implemented by A, B1 and B2. I_A just declares all public methods of A and in B1 and B2 you implement this interface by delegation. That is in B1 and B2 you have a reference to a A object and all I_A methods on B1 and B2 are just routed to this reference. That way distinct instances of B1 and B2 can easily share a common A reference. HTH, Gerhard On Tue, 21 Oct 2003 00:27:02 -0400, Matt Mastrangelo <[EMAIL PROTECTED]> wrote: Chris, Just to clarify -- are you saying it's not possible to create the User instance without also creating a new Person instance? Maybe my example was not too clear. Let me re-explain: I have a base class A with two subclasses, B1 and B2. I have already created an instance of B1 and stored it to the database, which means that an A record and a B1 record were inserted. I now want to create an instance of B2 that extends from the same A record as B1. Is this possible? Thanks again. Matt [EMAIL PROTECTED] wrote: Matt, I believe since the Person and Student object exist it will set there values to null except the personId. Because in the User instance you are storing allthe other fields are null (if you set them to null when you declare them) except the loginName. So, ojb will know that person and student 001 exist and will do and update instead of an insert. You should create them on the first store. Or do not have user extend Student, instead have a 1:1 relationship. Depends on your requirments i guess. -chris worley I'm trying to figure out how to store a new persisted object that extends a pre-existing object. For example, I have 3 classes: Person, Student, and User. Student and User extend Person. A Student object already exists, and I now want to create a User object that inherits from the same Person as the Student object. Is this possible? Here's a code example: User user = new User(); user.setLoginName("matt"); user.setPersonOid("001"); // A pre-existing person broker.beginTransaction(); broker.store(user); broker.commitTransaction(); The result of the above code is a NEW empty person object being created with a newly generated OID (via a sequence). How can I associate the new User with a pre-existing Person? Thanks again. Matt - 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] -- Matt Mastrangelo X2 Development Corporation 781-740-2679 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
question about 1:1 relation
Hi, I have an unidirectionnal 1:1 association between two objects : IndividuDTO and IndBacDTO Somewhere in my code, I do this : IndividuDTO individu = broker.getObjectByQuery(...); //Retrieve the IndividuDTO individu.setIdBac( 0 ); individu.setBacIndividu( null ); broker.store(individu); I want that the old BacIndividuDTO to be deleted into the database. Do I have to delete it explicitelly or is there a way to delete it automatically ?? Thanks Vincent
Re: Inheritance mapping, storing new object associated with pre-existingsuper object
Hi Matt, Excuse me to jump in here, but I believe what you have in mind is not possible in Java and even less with OJB. If your B1 and B2 instance should 'contain' the same A instance as base class, they are identical objects, which would require a language that supports multiple inheritance (and virtual base classes). You could do that in in C++ but not in Java. What you can do in Java (and OJB) is declare an interface I_A implemented by A, B1 and B2. I_A just declares all public methods of A and in B1 and B2 you implement this interface by delegation. That is in B1 and B2 you have a reference to a A object and all I_A methods on B1 and B2 are just routed to this reference. That way distinct instances of B1 and B2 can easily share a common A reference. HTH, Gerhard On Tue, 21 Oct 2003 00:27:02 -0400, Matt Mastrangelo <[EMAIL PROTECTED]> wrote: >Chris, > >Just to clarify -- are you saying it's not possible to create the User >instance without also creating a new Person instance? Maybe my example >was not too clear. Let me re-explain: > >I have a base class A with two subclasses, B1 and B2. I have already >created an instance of B1 and stored it to the database, which means >that an A record and a B1 record were inserted. I now want to create an >instance of B2 that extends from the same A record as B1. Is this possible? > >Thanks again. > >Matt > >[EMAIL PROTECTED] wrote: > >>Matt, >> >>I believe since the Person and Student object exist it will set there >>values to null except the personId. Because in the User instance you are >>storing allthe other fields are null (if you set them to null when you >>declare them) except the loginName. So, ojb will know that person and >>student 001 exist and will do and update instead of an insert. >> >>You should create them on the first store. Or do not have user extend >>Student, instead have a 1:1 relationship. Depends on your requirments i >>guess. >> >>-chris worley >> >> >> >>>I'm trying to figure out how to store a new persisted object that >>>extends a pre-existing object. >>> >>>For example, I have 3 classes: Person, Student, and User. Student and >>>User extend Person. A Student object already exists, and I now want to >>>create a User object that inherits from the same Person as the Student >>>object. Is this possible? Here's a code example: >>> >>>User user = new User(); >>>user.setLoginName("matt"); >>>user.setPersonOid("001"); // A pre-existing person >>> >>>broker.beginTransaction(); >>>broker.store(user); >>>broker.commitTransaction(); >>> >>>The result of the above code is a NEW empty person object being created >>>with a newly generated OID (via a sequence). How can I associate the >>>new User with a pre-existing Person? >>> >>>Thanks again. >>> >>>Matt >>> >>> >>> >>>- >>>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: update problem
hi, check that the primary key is not set to null in the object that you are going to store. If the primary key is of numeric type, also check that the value is not 0 (not primitive 0 nor Number.longValue() == 0), or it will be interpreted as null causing an insert instead of an update. hope to be of any help danilo I'm having a problem with updates. I haven't had this problem in the past with OJB, and thought I'd throw out a question before I start stepping through the code. I've been using OJB for the last 18 months and don't remember seeing this problem. I query OJB to get my object to update, using the primary key. I update the object, then call broker.store to update the object. However, the object, which is defined in th repository with "autoincrement=true" for the primary key, is INSERTed and NOT updated. I've tried this with HSQLDB and ORACLE. It's happening with both. I'm using release candidate 4 of OJB. Any hints are greatly appreciated. Oh, and I've tried explicitly telling OJB to do an update not an insert. :( - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
update problem
I'm having a problem with updates. I haven't had this problem in the past with OJB, and thought I'd throw out a question before I start stepping through the code. I've been using OJB for the last 18 months and don't remember seeing this problem. I query OJB to get my object to update, using the primary key. I update the object, then call broker.store to update the object. However, the object, which is defined in th repository with "autoincrement=true" for the primary key, is INSERTed and NOT updated. I've tried this with HSQLDB and ORACLE. It's happening with both. I'm using release candidate 4 of OJB. Any hints are greatly appreciated. Oh, and I've tried explicitly telling OJB to do an update not an insert. :( -- Charles E Brault [EMAIL PROTECTED] "Where are we going, and why am I in this handbasket?" - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Looking for advice on how to set up Xdoclet Ojb modules
You don't have to use the OJB CVS version, you only should use the xdoclet module from the CVS (its newer than the one with rc4). If you use the module with a stable release, then it might be that some generated attributes in the XML descriptor are not recognized by OJB, but I think this is only the case with versions older than rc4. I'd strongly advise you to use the xdoclet jars supplied with the xdoclet ojb module, or to use the CVS HEAD from xdoclet. First, the xdoclet CVS HEAD is quite stable (at least concerning the xdoclet core and the major modules like EJB), and secondly there might have been API changes since the last stable release. It might work with the 1.2b3 release , but I didn't test it (I know however that it does not work with 1.2b2 and older). Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]