[JBoss-dev] Fast Updates Based on Row ID
Hi Marc, When you were here in London we'd discussed adding functionality to use things like ROWID for fast updates and deletes [as opposed to using primary keys]. I have been able to implement this by 1. Adding a field in jaws.xml called rowid-column name. This is ROWID for Oracle and can be something else for other databases. If you do not want to use this feature just don't specify the tag and it will use the default mechansm based on the primary key. 2. Updated JDBCStoreEntityCommand as follows protected String makeSQL(Object argOrArgs) { ExecutionState es = (ExecutionState)argOrArgs; // NB: null if tuned boolean tuned = jawsEntity.hasTunedUpdates(); //Added by Vinay Menon - Start String rowIDColumn = jawsEntity.getRowIDColumnName(); //Added by Vinay Menon - End String sql = "UPDATE "+jawsEntity.getTableName()+" SET "; Iterator iter = jawsEntity.getCMPFields(); int i = 0; boolean first = true; while (iter.hasNext()) { CMPFieldMetaData cmpField = (CMPFieldMetaData)iter.next(); if(!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) { if (!tuned || es.dirtyField[i++]) { sql += (first?"":",") + cmpField.getColumnName() + "=?"; first = false; } } } //Modified by Vinay Menon - Start sql += " WHERE "; if(rowIDColumn!=null && rowIDColumn.trim().length()>1) { sql += rowIDColumn+" =?"; } else { sql += getPkColumnWhereList(); } //Modified by Vinay Menon - End return sql; } and protected void setParameters(PreparedStatement stmt, Object argOrArgs) throws Exception { ExecutionState es = (ExecutionState)argOrArgs; boolean tuned = jawsEntity.hasTunedUpdates(); //Added by Vinay Menon - Start String rowIDColumn = jawsEntity.getRowIDColumnName(); //Added by Vinay Menon - End int idx = 1; Iterator iter = jawsEntity.getCMPFields(); int i = 0; Object rowIDValue=null; int rowIDJDBCType=0; while (iter.hasNext()) { CMPFieldMetaData cmpField = (CMPFieldMetaData)iter.next(); f((!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) && (!cmpField.getName().equalsIgnoreCase(rowIDColumn))) { rowIDValue = es.currentState[i]; rowIDJDBCType = cmpField.getJDBCType(); } else { if (!tuned || es.dirtyField[i]) { setParameter(stmt, idx++, cmpField.getJDBCType(), es.currentState[i]); } } i++; } if(rowIDColumn!=null) { setParameter(stmt,idx,rowIDJDBCType,rowIDValue); } else { setPrimaryKeyParameters(stmt, idx, es.ctx.getId()); } //Modified by Vinay Menon - End } 3. Similarly updated JDBCRemoveEntityCommand as protected void setParameters(PreparedStatement stmt, Object argOrArgs) throws Exception { EntityEnterpriseContext ctx = (EntityEnterpriseContext)argOrArgs; ExecutionState es = (ExecutionState)argOrArgs; //Modified by Vinay Menon - Start String rowIDColumn = jawsEntity.getRowIDColumnName(); int i=0; if(rowIDColumn!=null) { Iterator iter = jawsEntity.getCMPFields(); while (iter.hasNext()) { CMPFieldMetaData cmpField = (CMPFieldMetaData)iter.next(); if(cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) { System.out.println("Delete for "+rowIDColumn+"="+es.currentState[i]); setParameter(stmt, 1, cmpField.getJDBCType(), es.currentState[i]); } i++; } } else { setPrimaryKeyParameters(stmt, 1, ctx.getId()); } //Modified by Vinay Menon - Start } and public JDBCRemoveEntityCommand(JDBCCommandFactory factory) { super(factory, "Remove"); //Modified by Vinay Menon - Start String rowIDColumn = jawsEntity.getRowIDColumnName(); String sql; if(rowIDColumn!=null) { // Remove SQL sql = "DELETE FROM " + jawsEntity.getTableName() +" WHERE "+rowIDColumn+"=?"; } else { // Remove SQL sql = "DELETE FROM " + jawsEntity.getTableName() + " WHERE "+getPkColumnWhereList(); } //Modified by Vinay Menon - End setSQL(sql); } 3. Updated JawsEntityMetaData with public String getRowIDColumnName() { return rowIDColumnName; } //Added by Vinay Menon - Start //If a rowid [as in Oracle is present use it to optimize updates and deleted rowIDColumnName = getElementContent(getOptionalChild(e
Re: [JBoss-dev] Fast Updates Based on Row ID
Hi, This looks very interesting. I'm kind of too lazy to read your code to find out the answer for myself... My impression is that Oracle ROWID and similar facilities such as Interbase/firebird dbkey are stable only within a transaction, and in fact expected to change with any update. Could you please explain how your new feature guarantees updating the correct row with commit options A, B, C, and D? Thanks david jencks On 2001.06.06 08:56:02 -0400 K.V. Vinay Menon wrote: > Hi Marc, > When you were here in London we'd discussed adding functionality to > use things like ROWID for fast updates and deletes [as opposed to using > primary keys]. I have been able to implement this by > > 1. Adding a field in jaws.xml called rowid-column name. This is ROWID for > Oracle and can be something else for other databases. If you do not want > to use this feature just don't specify the tag and it will use the > default mechansm based on the primary key. > > ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
I'll get this patch in later today. K.V. Vinay Menon wrote: > Hi Marc, > > When you were here in London we'd discussed adding functionality to > use things like ROWID for fast updates and deletes [as opposed to using > primary keys]. I have been able to implement this by > > > > 1. Adding a field in jaws.xml called rowid-column name. This is ROWID > for Oracle and can be something else for other databases. If you do not > want to use this feature just don't specify the tag and it will use the > default mechansm based on the primary key. > > > > 2. Updated JDBCStoreEntityCommand as follows > > > >protected String makeSQL(Object argOrArgs) >{ > ExecutionState es = (ExecutionState)argOrArgs; // NB: null if tuned > boolean tuned = jawsEntity.hasTunedUpdates(); > > > > //Added by Vinay Menon - Start > String rowIDColumn = jawsEntity.getRowIDColumnName(); > //Added by Vinay Menon - End > > > > String sql = "UPDATE "+jawsEntity.getTableName()+" SET "; > Iterator iter = jawsEntity.getCMPFields(); > int i = 0; > boolean first = true; > while (iter.hasNext()) > { > CMPFieldMetaData cmpField = (CMPFieldMetaData)iter.next(); > > > > if(!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) > { > if (!tuned || es.dirtyField[i++]) > { > sql += (first?"":",") + >cmpField.getColumnName() + "=?"; > first = false; > } > } > } > > > > //Modified by Vinay Menon - Start > sql += " WHERE "; > > > > if(rowIDColumn!=null && rowIDColumn.trim().length()>1) > { > sql += rowIDColumn+" =?"; > } > else > { > sql += getPkColumnWhereList(); > } > //Modified by Vinay Menon - End > > > > return sql; >} > > and > > > >protected void setParameters(PreparedStatement stmt, Object argOrArgs) > throws Exception >{ > ExecutionState es = (ExecutionState)argOrArgs; > boolean tuned = jawsEntity.hasTunedUpdates(); > > > > //Added by Vinay Menon - Start > String rowIDColumn = jawsEntity.getRowIDColumnName(); > //Added by Vinay Menon - End > > > > int idx = 1; > Iterator iter = jawsEntity.getCMPFields(); > int i = 0; > > > > Object rowIDValue=null; > int rowIDJDBCType=0; > > > > while (iter.hasNext()) > { > CMPFieldMetaData cmpField = (CMPFieldMetaData)iter.next(); > > > > > f((!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) && > (!cmpField.getName().equalsIgnoreCase(rowIDColumn))) > { > rowIDValue = es.currentState[i]; > rowIDJDBCType = cmpField.getJDBCType(); > } else { > if (!tuned || es.dirtyField[i]) > { > setParameter(stmt, idx++, cmpField.getJDBCType(), > es.currentState[i]); > } > } > > > > i++; > } > > > > if(rowIDColumn!=null) > { > setParameter(stmt,idx,rowIDJDBCType,rowIDValue); > } > else > { > setPrimaryKeyParameters(stmt, idx, es.ctx.getId()); > } > //Modified by Vinay Menon - End >} > > 3. Similarly updated JDBCRemoveEntityCommand as > > > > protected void setParameters(PreparedStatement stmt, Object argOrArgs) > throws Exception >{ > EntityEnterpriseContext ctx = (EntityEnterpriseContext)argOrArgs; > > > > ExecutionState es = (ExecutionState)argOrArgs; > > > > //Modified by Vinay Menon - Start > String rowIDColumn = jawsEntity.getRowIDColumnName(); > int i=0; > > > > if(rowIDColumn!=null) > { > Iterator iter = jawsEntity.getCMPFields(); > while (iter.hasNext()) > { > CMPFieldMetaData cmpField = (CMPFieldMetaData)iter.next(); > > > > if(cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) > { > System.out.println("Delete for > "+rowIDColumn+"="+es.currentState[i]); > setParameter(stmt, 1, cmpField.getJDBCType(), > es.currentState[i]); > } > > > > i++; > } > } > else > { > setPrimaryKeyParameters(stmt, 1, ctx.getId()); > } > //Modified by Vinay Menon - Start >} > > > > and > > > >public JDBCRemoveEntityCommand(JDBCCommandFactory factory) >{ > super(factory, "Remove"); > > > > > //Modified by Vinay Menon - Start > String rowIDColumn = jawsEntity.getRowIDColumnName(); > > > > String sql; > > > > if(rowIDColumn!=null) > { > // Remove SQL > sql = "DELETE FROM " + jawsEntity.getTableName() +" WHERE > "+rowIDColumn+"=?"; > } >
Re: [JBoss-dev] Fast Updates Based on Row ID
Dan Ch, Have not submitted the patch as yet. I'll check it in once people think its alright. Do you want me to send you complete source files for the changes? Vinay - Original Message - From: "danch" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 06, 2001 6:17 PM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > I'll get this patch in later today. > > K.V. Vinay Menon wrote: > > > Hi Marc, > > > > When you were here in London we'd discussed adding functionality to > > use things like ROWID for fast updates and deletes [as opposed to using > > primary keys]. I have been able to implement this by > > > > > > > > 1. Adding a field in jaws.xml called rowid-column name. This is ROWID > > for Oracle and can be something else for other databases. If you do not > > want to use this feature just don't specify the tag and it will use the > > default mechansm based on the primary key. > > > > > > > > 2. Updated JDBCStoreEntityCommand as follows > > > > > > > >protected String makeSQL(Object argOrArgs) > >{ > > ExecutionState es = (ExecutionState)argOrArgs; // NB: null if tuned > > boolean tuned = jawsEntity.hasTunedUpdates(); > > > > > > > > //Added by Vinay Menon - Start > > String rowIDColumn = jawsEntity.getRowIDColumnName(); > > //Added by Vinay Menon - End > > > > > > > > String sql = "UPDATE "+jawsEntity.getTableName()+" SET "; > > Iterator iter = jawsEntity.getCMPFields(); > > int i = 0; > > boolean first = true; > > while (iter.hasNext()) > > { > > CMPFieldMetaData cmpField = (CMPFieldMetaData)iter.next(); > > > > > > > > if(!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) > > { > > if (!tuned || es.dirtyField[i++]) > > { > > sql += (first?"":",") + > >cmpField.getColumnName() + "=?"; > > first = false; > > } > > } > > } > > > > > > > > //Modified by Vinay Menon - Start > > sql += " WHERE "; > > > > > > > > if(rowIDColumn!=null && rowIDColumn.trim().length()>1) > > { > > sql += rowIDColumn+" =?"; > > } > > else > > { > > sql += getPkColumnWhereList(); > > } > > //Modified by Vinay Menon - End > > > > > > > > return sql; > >} > > > > and > > > > > > > >protected void setParameters(PreparedStatement stmt, Object argOrArgs) > > throws Exception > >{ > > ExecutionState es = (ExecutionState)argOrArgs; > > boolean tuned = jawsEntity.hasTunedUpdates(); > > > > > > > > //Added by Vinay Menon - Start > > String rowIDColumn = jawsEntity.getRowIDColumnName(); > > //Added by Vinay Menon - End > > > > > > > > int idx = 1; > > Iterator iter = jawsEntity.getCMPFields(); > > int i = 0; > > > > > > > > Object rowIDValue=null; > > int rowIDJDBCType=0; > > > > > > > > while (iter.hasNext()) > > { > > CMPFieldMetaData cmpField = (CMPFieldMetaData)iter.next(); > > > > > > > > > > f((!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) && > > (!cmpField.getName().equalsIgnoreCase(rowIDColumn))) > > { > > rowIDValue = es.currentState[i]; > > rowIDJDBCType = cmpField.getJDBCType(); > > } else { > > if (!tuned || es.dirtyField[i]) > > { > > setParameter(stmt, idx++, cmpField.getJDBCType(), > > es.currentState[i]); > > } > > } > > > > > > > > i++; > > } > > > > > > > > if(rowIDColumn!=null) > > { > > setParameter(stmt,idx,rowIDJDBCType,rowIDValue); > > } > > else > > { > > setPrimaryKeyParameters(stmt, idx, es.ctx.getId()); > > } > > //Modified by Vinay Menon - End > >} > > > > 3. Similarly updated JDBCRemoveEntityCom
Re: [JBoss-dev] Fast Updates Based on Row ID
Locks will be in place since the rowid stuff is applicable only for updates and deletes. selects obviously cannot work with this! Also, to the best of my knowledge Oracle row ids are fixed unless you move them to new db i.e. export or stuff. Vinay - Original Message - From: "Georg Rehfeld" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 06, 2001 2:57 PM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > Hi Vinay, > > as far as I can remember from my Oracle times using the ROWID is > only allowed inside transactions and when you got the row with > SELECT ... FOR UPDATE else the ROWID isn't fixed, but may change, > when other clients update the row (at least when the update > causes the row to be moved to another block in the DB, as the > ROWID in Oracle is the physical address of the row). > > I havn't the docs handy, if you have them online, then you might > search for ROWID until you find that precondition, sorry, but I'm > pretty sure it exists. > > In your code I couldn't find checks for either, at least the > JAWS option should be available and checked > for true, migth be this is enough checking there, as select for > update is valid inside transactions only anyway. > > regards > Georg > ___ ___ > | + | |__Georg Rehfeld Woltmanstr. 12 20097 Hamburg > |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10 > > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
The ROW ID bit does not touch ANY other portion in the JBoss source except for a) Generating SQLs b) Setting parameters. Options A,B and C should work as usual, correct me if I am wrong. As for option D, I am suprised that it has become part of our 'standard' commit options. I wrote some code and never had a chance to commit it and unless someone else has commited stuff for option D let me know and I'll have to commit the code! Vinay - Original Message - From: "David Jencks" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 06, 2001 2:40 PM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > Hi, > > This looks very interesting. I'm kind of too lazy to read your code to > find out the answer for myself... > > My impression is that Oracle ROWID and similar facilities such as > Interbase/firebird dbkey are stable only within a transaction, and in fact > expected to change with any update. Could you please explain how your new > feature guarantees updating the correct row with commit options A, B, C, > and D? > > Thanks > david jencks > > > On 2001.06.06 08:56:02 -0400 K.V. Vinay Menon wrote: > > Hi Marc, > > When you were here in London we'd discussed adding functionality to > > use things like ROWID for fast updates and deletes [as opposed to using > > primary keys]. I have been able to implement this by > > > > 1. Adding a field in jaws.xml called rowid-column name. This is ROWID for > > Oracle and can be something else for other databases. If you do not want > > to use this feature just don't specify the tag and it will use the > > default mechansm based on the primary key. > > > > > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Fast Updates Based on Row ID
Oracle doesn't move rows unless you reorganize the database. If a row grows so as to no longer fit in it's current block, then the block is chained (essentially another physical block is added and the two make one bigger logical block) and the row just expands into the new space with no change of rowid. Note that chained blocks are not a good thing. I believe that rowids will work fine for what Vinay is trying to do with them. Of course this is always subject to change if Oracle changes the way the database works. That being said, in all the time I've used Oracle (15 years) I've never gone down this path of using the rowid. For some reason I have a deep distrust of this strategy. Perhaps it was when I was an Oracle consultant and advised people against doing it. Who knows. Cheers -Original Message- From: K.V. Vinay Menon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 06, 2001 10:49 AM To: [EMAIL PROTECTED] Subject: Re: [JBoss-dev] Fast Updates Based on Row ID Locks will be in place since the rowid stuff is applicable only for updates and deletes. selects obviously cannot work with this! Also, to the best of my knowledge Oracle row ids are fixed unless you move them to new db i.e. export or stuff. Vinay - Original Message - From: "Georg Rehfeld" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 06, 2001 2:57 PM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > Hi Vinay, > > as far as I can remember from my Oracle times using the ROWID is > only allowed inside transactions and when you got the row with > SELECT ... FOR UPDATE else the ROWID isn't fixed, but may change, > when other clients update the row (at least when the update > causes the row to be moved to another block in the DB, as the > ROWID in Oracle is the physical address of the row). > > I havn't the docs handy, if you have them online, then you might > search for ROWID until you find that precondition, sorry, but I'm > pretty sure it exists. > > In your code I couldn't find checks for either, at least the > JAWS option should be available and checked > for true, migth be this is enough checking there, as select for > update is valid inside transactions only anyway. > > regards > Georg > ___ ___ > | + | |__Georg Rehfeld Woltmanstr. 12 20097 Hamburg > |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10 > > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Hi, I may be wrong about oracle rowid changing on row update, it's been a couple of years. However interbase/firebird dbkey definitely does change on update, and I think someone mentioned the sql server analogue does too. In this situation, it seems to me that commit option A cannot be used, since to get a valid rowid, you have to read the db within the same transaction you are updating in. Also, even in Oracle, how can this be used with a newly inserted bean? create --inserts row in db later in same transaction, change values on this bean, the generated save has no rowid unless you fetched it in perhaps ejbpostcreate??? If you can fix this one, perhaps it can also be used to fetch values supplied by triggers on insert, such as sequence/generators used for abstract id. Am I wrong here? Could you explain in detail how this will work? Thanks david jencks On 2001.06.06 10:50:53 -0400 K.V. Vinay Menon wrote: > The ROW ID bit does not touch ANY other portion in the JBoss source > except > for > > a) Generating SQLs > b) Setting parameters. > > Options A,B and C should work as usual, correct me if I am wrong. As for > option D, I am suprised that it has become part of our 'standard' commit > options. I wrote some code and never had a chance to commit it and unless > someone else has commited stuff for option D let me know and I'll have to > commit the code! > > Vinay > - Original Message - > From: "David Jencks" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, June 06, 2001 2:40 PM > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > > Hi, > > > > This looks very interesting. I'm kind of too lazy to read your code to > > find out the answer for myself... > > > > My impression is that Oracle ROWID and similar facilities such as > > Interbase/firebird dbkey are stable only within a transaction, and in > fact > > expected to change with any update. Could you please explain how your > new > > feature guarantees updating the correct row with commit options A, B, > C, > > and D? > > > > Thanks > > david jencks > > > > > > On 2001.06.06 08:56:02 -0400 K.V. Vinay Menon wrote: > > > Hi Marc, > > > When you were here in London we'd discussed adding functionality > to > > > use things like ROWID for fast updates and deletes [as opposed to > using > > > primary keys]. I have been able to implement this by > > > > > > 1. Adding a field in jaws.xml called rowid-column name. This is ROWID > for > > > Oracle and can be something else for other databases. If you do not > want > > > to use this feature just don't specify the tag and it will use the > > > default mechansm based on the primary key. > > > > > > > > > > > > ___ > > Jboss-development mailing list > > [EMAIL PROTECTED] > > http://lists.sourceforge.net/lists/listinfo/jboss-development > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development > ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Fast Updates Based on Row ID
Use "insert ... returning rowid into ?" -Original Message- From: David Jencks [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 06, 2001 12:02 PM To: [EMAIL PROTECTED] Subject: Re: [JBoss-dev] Fast Updates Based on Row ID Hi, I may be wrong about oracle rowid changing on row update, it's been a couple of years. However interbase/firebird dbkey definitely does change on update, and I think someone mentioned the sql server analogue does too. In this situation, it seems to me that commit option A cannot be used, since to get a valid rowid, you have to read the db within the same transaction you are updating in. Also, even in Oracle, how can this be used with a newly inserted bean? create --inserts row in db later in same transaction, change values on this bean, the generated save has no rowid unless you fetched it in perhaps ejbpostcreate??? If you can fix this one, perhaps it can also be used to fetch values supplied by triggers on insert, such as sequence/generators used for abstract id. Am I wrong here? Could you explain in detail how this will work? Thanks david jencks On 2001.06.06 10:50:53 -0400 K.V. Vinay Menon wrote: > The ROW ID bit does not touch ANY other portion in the JBoss source > except > for > > a) Generating SQLs > b) Setting parameters. > > Options A,B and C should work as usual, correct me if I am wrong. As for > option D, I am suprised that it has become part of our 'standard' commit > options. I wrote some code and never had a chance to commit it and unless > someone else has commited stuff for option D let me know and I'll have to > commit the code! > > Vinay > - Original Message - > From: "David Jencks" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, June 06, 2001 2:40 PM > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > > Hi, > > > > This looks very interesting. I'm kind of too lazy to read your code to > > find out the answer for myself... > > > > My impression is that Oracle ROWID and similar facilities such as > > Interbase/firebird dbkey are stable only within a transaction, and in > fact > > expected to change with any update. Could you please explain how your > new > > feature guarantees updating the correct row with commit options A, B, > C, > > and D? > > > > Thanks > > david jencks > > > > > > On 2001.06.06 08:56:02 -0400 K.V. Vinay Menon wrote: > > > Hi Marc, > > > When you were here in London we'd discussed adding functionality > to > > > use things like ROWID for fast updates and deletes [as opposed to > using > > > primary keys]. I have been able to implement this by > > > > > > 1. Adding a field in jaws.xml called rowid-column name. This is ROWID > for > > > Oracle and can be something else for other databases. If you do not > want > > > to use this feature just don't specify the tag and it will use the > > > default mechansm based on the primary key. > > > > > > > > > > > > ___ > > Jboss-development mailing list > > [EMAIL PROTECTED] > > http://lists.sourceforge.net/lists/listinfo/jboss-development > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development > ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Hi Vinay, > Locks will be in place since the rowid stuff is applicable only for updates > and deletes. selects obviously cannot work with this! Also, to the best of > my knowledge Oracle row ids are fixed unless you move them to new db i.e. > export or stuff. Lazyness is one sort of stupidness, so I tried to be not so stupid anymore and looked it up ... turned out you are right and I was wrong! At least since Oracle 7 the ROWID remains fixed and is explicitely usable for fast access to rows even surviving commits/transactions and without any need to select ... for update. See http://technet.oracle.com/doc/server.815/a67781/c10datyp.htm or read the essential excerpt here: | Physical rowids provide the fastest possible access to a row of a | given table. They contain the physical address of a row (down to | the specific block), and essentially allow you to retrieve the | row in a single block access. Oracle guarantees that as long as | the row exists, its rowid does not change. These performance and | stability qualities make rowids useful for applications that | select a set of rows, perform some operations on them, and then | access some of the selected rows again, perhaps with the purpose | of updating them. ... | A row's assigned rowid remains unchanged unless the row is | exported and imported (using the IMPORT and EXPORT utilities). | When you delete a row from a table (and then commit the | encompassing transaction), the deleted row's associated rowid can | be assigned to a row inserted in a subsequent transaction. ... | A row's logical rowid does not change as long as the primary key | value does not change. This is less stable than the physical | rowid, which stays immutable through all updates to the row. Sorry to have bothered you regards Georg ___ ___ | + | |__Georg Rehfeld Woltmanstr. 12 20097 Hamburg |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10 ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Will the 'returning into ?' work in databases other than oracle? If not, that would be a problem: until JAWS is chainsawed (refactored to separate SQL syntax from the Command hierarchy), it'll be difficult to manage DB specific stuff at that level. Vinay's original patch isn't too bad, because it doesn't cause us to generate syntax that won't work elsewhere (you could give the name of a normal column as the rowid column and it would work (so long as that column is unique)) Jay Walters wrote: > Use "insert ... returning rowid into ?" > > -Original Message- > From: David Jencks [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 06, 2001 12:02 PM > To: [EMAIL PROTECTED] > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > Hi, > > I may be wrong about oracle rowid changing on row update, it's been a > couple of years. However interbase/firebird dbkey definitely does change > on update, and I think someone mentioned the sql server analogue does too. > > In this situation, it seems to me that commit option A cannot be used, > since to get a valid rowid, you have to read the db within the same > transaction you are updating in. > > Also, even in Oracle, how can this be used with a newly inserted bean? > > create --inserts row in db > > later in same transaction, change values on this bean, the generated save > has no rowid unless you fetched it in perhaps ejbpostcreate??? If you can > fix this one, perhaps it can also be used to fetch values supplied by > triggers on insert, such as sequence/generators used for abstract id. > > Am I wrong here? Could you explain in detail how this will work? > > Thanks > david jencks > > On 2001.06.06 10:50:53 -0400 K.V. Vinay Menon wrote: > >>The ROW ID bit does not touch ANY other portion in the JBoss source >>except >>for >> >>a) Generating SQLs >>b) Setting parameters. >> >>Options A,B and C should work as usual, correct me if I am wrong. As for >>option D, I am suprised that it has become part of our 'standard' commit >>options. I wrote some code and never had a chance to commit it and unless >>someone else has commited stuff for option D let me know and I'll have to >>commit the code! >> >>Vinay >>- Original Message - >>From: "David Jencks" <[EMAIL PROTECTED]> >>To: <[EMAIL PROTECTED]> >>Sent: Wednesday, June 06, 2001 2:40 PM >>Subject: Re: [JBoss-dev] Fast Updates Based on Row ID >> >> >> >>>Hi, >>> >>>This looks very interesting. I'm kind of too lazy to read your code to >>>find out the answer for myself... >>> >>>My impression is that Oracle ROWID and similar facilities such as >>>Interbase/firebird dbkey are stable only within a transaction, and in >>> >>fact >> >>>expected to change with any update. Could you please explain how your >>> >>new >> >>>feature guarantees updating the correct row with commit options A, B, >>> >>C, >> >>>and D? >>> >>>Thanks >>>david jencks >>> >>> >>>On 2001.06.06 08:56:02 -0400 K.V. Vinay Menon wrote: >>> >>>>Hi Marc, >>>>When you were here in London we'd discussed adding functionality >>>> >>to >> >>>>use things like ROWID for fast updates and deletes [as opposed to >>>> >>using >> >>>>primary keys]. I have been able to implement this by >>>> >>>>1. Adding a field in jaws.xml called rowid-column name. This is ROWID >>>> >>for >> >>>>Oracle and can be something else for other databases. If you do not >>>> >>want >> >>>>to use this feature just don't specify the tag and it will use the >>>>default mechansm based on the primary key. >>>> >>>> >>>> >>> >>>___ >>>Jboss-development mailing list >>>[EMAIL PROTECTED] >>>http://lists.sourceforge.net/lists/listinfo/jboss-development >>> >> >>___ >>Jboss-development mailing list >>[EMAIL PROTECTED] >>http://lists.sourceforge.net/lists/listinfo/jboss-development >> >> > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development > Confidential e-mail for addressee only. Access to this e-mail by anyone else is unauthorized. If you have received this message in error, please notify the sender immediately by reply e-mail and destroy the original communication.
RE: [JBoss-dev] Fast Updates Based on Row ID
This is oracle specific as far as I know (insert...returning...). The create problem needs to be addressed if one cannot retrieve the rowid, the logic needs to check and see if rowid is set or not - maybe Vinay already did this, I didn't look that hard. It's not clear to me what this will do for us. It is likely the index page will have been paged into the buffer cache to handle the initial query which returned the row so I don't see this saving a lot of disk i/o, just some cpu cycles. For example, depending on how one is creating the keys for new rows a better improvement might be to embed oracle specific code into the creation to query a sequence for the key. If there is a goal to really speed up Jaws when using Oracle or some other database we should probably really analyze what it's doing, unless somebody is already doing that. Cheers -Original Message- From: danch (Dan Christopherson) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 06, 2001 12:59 PM To: [EMAIL PROTECTED] Subject: Re: [JBoss-dev] Fast Updates Based on Row ID Will the 'returning into ?' work in databases other than oracle? If not, that would be a problem: until JAWS is chainsawed (refactored to separate SQL syntax from the Command hierarchy), it'll be difficult to manage DB specific stuff at that level. Vinay's original patch isn't too bad, because it doesn't cause us to generate syntax that won't work elsewhere (you could give the name of a normal column as the rowid column and it would work (so long as that column is unique)) Jay Walters wrote: > Use "insert ... returning rowid into ?" > > -Original Message- > From: David Jencks [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 06, 2001 12:02 PM > To: [EMAIL PROTECTED] > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > Hi, > > I may be wrong about oracle rowid changing on row update, it's been a > couple of years. However interbase/firebird dbkey definitely does change > on update, and I think someone mentioned the sql server analogue does too. > > In this situation, it seems to me that commit option A cannot be used, > since to get a valid rowid, you have to read the db within the same > transaction you are updating in. > > Also, even in Oracle, how can this be used with a newly inserted bean? > > create --inserts row in db > > later in same transaction, change values on this bean, the generated save > has no rowid unless you fetched it in perhaps ejbpostcreate??? If you can > fix this one, perhaps it can also be used to fetch values supplied by > triggers on insert, such as sequence/generators used for abstract id. > > Am I wrong here? Could you explain in detail how this will work? > > Thanks > david jencks > > On 2001.06.06 10:50:53 -0400 K.V. Vinay Menon wrote: > >>The ROW ID bit does not touch ANY other portion in the JBoss source >>except >>for >> >>a) Generating SQLs >>b) Setting parameters. >> >>Options A,B and C should work as usual, correct me if I am wrong. As for >>option D, I am suprised that it has become part of our 'standard' commit >>options. I wrote some code and never had a chance to commit it and unless >>someone else has commited stuff for option D let me know and I'll have to >>commit the code! >> >>Vinay >>- Original Message - >>From: "David Jencks" <[EMAIL PROTECTED]> >>To: <[EMAIL PROTECTED]> >>Sent: Wednesday, June 06, 2001 2:40 PM >>Subject: Re: [JBoss-dev] Fast Updates Based on Row ID >> >> >> >>>Hi, >>> >>>This looks very interesting. I'm kind of too lazy to read your code to >>>find out the answer for myself... >>> >>>My impression is that Oracle ROWID and similar facilities such as >>>Interbase/firebird dbkey are stable only within a transaction, and in >>> >>fact >> >>>expected to change with any update. Could you please explain how your >>> >>new >> >>>feature guarantees updating the correct row with commit options A, B, >>> >>C, >> >>>and D? >>> >>>Thanks >>>david jencks >>> >>> >>>On 2001.06.06 08:56:02 -0400 K.V. Vinay Menon wrote: >>> >>>>Hi Marc, >>>>When you were here in London we'd discussed adding functionality >>>> >>to >> >>>>use things like ROWID for fast updates and deletes [as opposed to >>>> >>using >> >>>>primary keys]. I have been able to implement thi
Re: [JBoss-dev] Fast Updates Based on Row ID
Hi Dan, Jay, all, > Will the 'returning into ?' work in databases other than > oracle? If not, that would be a problem: until JAWS is chainsawed > (refactored to separate SQL syntax from the Command hierarchy), it'll be > difficult to manage DB specific stuff at that level. Vinay's original > patch isn't too bad, because it doesn't cause us to generate syntax that > won't work elsewhere (you could give the name of a normal column as the > rowid column and it would work (so long as that column is unique)) The 'returning into ?' was introduced in Oracle 8, Oracle 7 definitely doesn't have it (this time I DID look it up befor posting) and Oracle 7 is out still in the fields. regards Georg ___ ___ | + | |__Georg Rehfeld Woltmanstr. 12 20097 Hamburg |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10 ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Well, We are an Oracle shop and woudl benefit [like loads of other Oracle users] from these changes. Remember they are there as an option. If you choose not to use them JAWS will work as usual. Vinay - Original Message - From: "Jay Walters" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 06, 2001 6:18 PM Subject: RE: [JBoss-dev] Fast Updates Based on Row ID > This is oracle specific as far as I know (insert...returning...). The > create problem needs to be addressed if one cannot retrieve the rowid, the > logic needs to check and see if rowid is set or not - maybe Vinay already > did this, I didn't look that hard. > > It's not clear to me what this will do for us. It is likely the index page > will have been paged into the buffer cache to handle the initial query which > returned the row so I don't see this saving a lot of disk i/o, just some cpu > cycles. For example, depending on how one is creating the keys for new rows > a better improvement might be to embed oracle specific code into the > creation to query a sequence for the key. If there is a goal to really > speed up Jaws when using Oracle or some other database we should probably > really analyze what it's doing, unless somebody is already doing that. > > Cheers > > -Original Message- > From: danch (Dan Christopherson) [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 06, 2001 12:59 PM > To: [EMAIL PROTECTED] > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > Will the 'returning into ?' work in databases other than > oracle? If not, that would be a problem: until JAWS is chainsawed > (refactored to separate SQL syntax from the Command hierarchy), it'll be > difficult to manage DB specific stuff at that level. Vinay's original > patch isn't too bad, because it doesn't cause us to generate syntax that > won't work elsewhere (you could give the name of a normal column as the > rowid column and it would work (so long as that column is unique)) > > Jay Walters wrote: > > > Use "insert ... returning rowid into ?" > > > > -Original Message- > > From: David Jencks [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, June 06, 2001 12:02 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > > > > Hi, > > > > I may be wrong about oracle rowid changing on row update, it's been a > > couple of years. However interbase/firebird dbkey definitely does change > > on update, and I think someone mentioned the sql server analogue does too. > > > > In this situation, it seems to me that commit option A cannot be used, > > since to get a valid rowid, you have to read the db within the same > > transaction you are updating in. > > > > Also, even in Oracle, how can this be used with a newly inserted bean? > > > > create --inserts row in db > > > > later in same transaction, change values on this bean, the generated save > > has no rowid unless you fetched it in perhaps ejbpostcreate??? If you can > > fix this one, perhaps it can also be used to fetch values supplied by > > triggers on insert, such as sequence/generators used for abstract id. > > > > Am I wrong here? Could you explain in detail how this will work? > > > > Thanks > > david jencks > > > > On 2001.06.06 10:50:53 -0400 K.V. Vinay Menon wrote: > > > >>The ROW ID bit does not touch ANY other portion in the JBoss source > >>except > >>for > >> > >>a) Generating SQLs > >>b) Setting parameters. > >> > >>Options A,B and C should work as usual, correct me if I am wrong. As for > >>option D, I am suprised that it has become part of our 'standard' commit > >>options. I wrote some code and never had a chance to commit it and unless > >>someone else has commited stuff for option D let me know and I'll have to > >>commit the code! > >> > >>Vinay > >>- Original Message - > >>From: "David Jencks" <[EMAIL PROTECTED]> > >>To: <[EMAIL PROTECTED]> > >>Sent: Wednesday, June 06, 2001 2:40 PM > >>Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > >> > >> > >> > >>>Hi, > >>> > >>>This looks very interesting. I'm kind of too lazy to read your code to > >>>find out the answer for myself... > >>> > >>>My impression is that Oracle ROWID and similar facilities such as > >>>Interbase/firebird dbkey are stable
RE: [JBoss-dev] Fast Updates Based on Row ID
Vinay, Can you provide any performance improvement numbers for this feature? 5% improvement 10%, etc.?? TIA, Bill > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of K.V. > Vinay Menon > Sent: Wednesday, June 06, 2001 1:59 PM > To: [EMAIL PROTECTED] > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > Well, > We are an Oracle shop and woudl benefit [like loads of other Oracle > users] from these changes. Remember they are there as an option. If you > choose not to use them JAWS will work as usual. > > Vinay > - Original Message - > From: "Jay Walters" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, June 06, 2001 6:18 PM > Subject: RE: [JBoss-dev] Fast Updates Based on Row ID > > > > This is oracle specific as far as I know (insert...returning...). The > > create problem needs to be addressed if one cannot retrieve the > rowid, the > > logic needs to check and see if rowid is set or not - maybe > Vinay already > > did this, I didn't look that hard. > > > > It's not clear to me what this will do for us. It is likely the index > page > > will have been paged into the buffer cache to handle the initial query > which > > returned the row so I don't see this saving a lot of disk i/o, just some > cpu > > cycles. For example, depending on how one is creating the keys for new > rows > > a better improvement might be to embed oracle specific code into the > > creation to query a sequence for the key. If there is a goal to really > > speed up Jaws when using Oracle or some other database we > should probably > > really analyze what it's doing, unless somebody is already doing that. > > > > Cheers > > > > -Original Message- > > From: danch (Dan Christopherson) [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, June 06, 2001 12:59 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > > > > Will the 'returning into ?' work in databases other than > > oracle? If not, that would be a problem: until JAWS is chainsawed > > (refactored to separate SQL syntax from the Command hierarchy), it'll be > > difficult to manage DB specific stuff at that level. Vinay's original > > patch isn't too bad, because it doesn't cause us to generate syntax that > > won't work elsewhere (you could give the name of a normal column as the > > rowid column and it would work (so long as that column is unique)) > > > > Jay Walters wrote: > > > > > Use "insert ... returning rowid into ?" > > > > > > -Original Message- > > > From: David Jencks [mailto:[EMAIL PROTECTED]] > > > Sent: Wednesday, June 06, 2001 12:02 PM > > > To: [EMAIL PROTECTED] > > > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > > > > > > > Hi, > > > > > > I may be wrong about oracle rowid changing on row update, it's been a > > > couple of years. However interbase/firebird dbkey definitely does > change > > > on update, and I think someone mentioned the sql server analogue does > too. > > > > > > In this situation, it seems to me that commit option A cannot be used, > > > since to get a valid rowid, you have to read the db within the same > > > transaction you are updating in. > > > > > > Also, even in Oracle, how can this be used with a newly inserted bean? > > > > > > create --inserts row in db > > > > > > later in same transaction, change values on this bean, the generated > save > > > has no rowid unless you fetched it in perhaps ejbpostcreate??? If you > can > > > fix this one, perhaps it can also be used to fetch values supplied by > > > triggers on insert, such as sequence/generators used for abstract id. > > > > > > Am I wrong here? Could you explain in detail how this will work? > > > > > > Thanks > > > david jencks > > > > > > On 2001.06.06 10:50:53 -0400 K.V. Vinay Menon wrote: > > > > > >>The ROW ID bit does not touch ANY other portion in the JBoss source > > >>except > > >>for > > >> > > >>a) Generating SQLs > > >>b) Setting parameters. > > >> > > >>Options A,B and C should work as usual, correct me if I am > wrong. As for > > >>option D, I am suprised that it has become part of our > 'standard'
Re: [JBoss-dev] Fast Updates Based on Row ID
Ok, Back to the row id issue, what if I just set the create method's transaction demaraction as 'RequiresNew'. That way all inserts will get commited immediately. Any succeeding requests from the same client would be on a different transaction and hence the rowid would not be returned as null. What do you think? Vinay - Original Message - From: "danch (Dan Christopherson)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 06, 2001 5:58 PM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > Will the 'returning into ?' work in databases other than > oracle? If not, that would be a problem: until JAWS is chainsawed > (refactored to separate SQL syntax from the Command hierarchy), it'll be > difficult to manage DB specific stuff at that level. Vinay's original > patch isn't too bad, because it doesn't cause us to generate syntax that > won't work elsewhere (you could give the name of a normal column as the > rowid column and it would work (so long as that column is unique)) > > Jay Walters wrote: > > > Use "insert ... returning rowid into ?" > > > > -Original Message- > > From: David Jencks [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, June 06, 2001 12:02 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > > > > Hi, > > > > I may be wrong about oracle rowid changing on row update, it's been a > > couple of years. However interbase/firebird dbkey definitely does change > > on update, and I think someone mentioned the sql server analogue does too. > > > > In this situation, it seems to me that commit option A cannot be used, > > since to get a valid rowid, you have to read the db within the same > > transaction you are updating in. > > > > Also, even in Oracle, how can this be used with a newly inserted bean? > > > > create --inserts row in db > > > > later in same transaction, change values on this bean, the generated save > > has no rowid unless you fetched it in perhaps ejbpostcreate??? If you can > > fix this one, perhaps it can also be used to fetch values supplied by > > triggers on insert, such as sequence/generators used for abstract id. > > > > Am I wrong here? Could you explain in detail how this will work? > > > > Thanks > > david jencks > > > > On 2001.06.06 10:50:53 -0400 K.V. Vinay Menon wrote: > > > >>The ROW ID bit does not touch ANY other portion in the JBoss source > >>except > >>for > >> > >>a) Generating SQLs > >>b) Setting parameters. > >> > >>Options A,B and C should work as usual, correct me if I am wrong. As for > >>option D, I am suprised that it has become part of our 'standard' commit > >>options. I wrote some code and never had a chance to commit it and unless > >>someone else has commited stuff for option D let me know and I'll have to > >>commit the code! > >> > >>Vinay > >>- Original Message - > >>From: "David Jencks" <[EMAIL PROTECTED]> > >>To: <[EMAIL PROTECTED]> > >>Sent: Wednesday, June 06, 2001 2:40 PM > >>Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > >> > >> > >> > >>>Hi, > >>> > >>>This looks very interesting. I'm kind of too lazy to read your code to > >>>find out the answer for myself... > >>> > >>>My impression is that Oracle ROWID and similar facilities such as > >>>Interbase/firebird dbkey are stable only within a transaction, and in > >>> > >>fact > >> > >>>expected to change with any update. Could you please explain how your > >>> > >>new > >> > >>>feature guarantees updating the correct row with commit options A, B, > >>> > >>C, > >> > >>>and D? > >>> > >>>Thanks > >>>david jencks > >>> > >>> > >>>On 2001.06.06 08:56:02 -0400 K.V. Vinay Menon wrote: > >>> > >>>>Hi Marc, > >>>>When you were here in London we'd discussed adding functionality > >>>> > >>to > >> > >>>>use things like ROWID for fast updates and deletes [as opposed to > >>>> > >>using > >> > >>>>primary keys]. I have been able to implement this by > >>>> > >>>>1. Adding a field in
Re: [JBoss-dev] Fast Updates Based on Row ID
Sorry, I stand corrected the rowid will not be updated automatically. - Original Message - From: "K.V. Vinay Menon" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 06, 2001 6:56 PM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > Ok, > I've changed the JDBCCreateEntityCommand as > >public JDBCCreateEntityCommand(JDBCCommandFactory factory) >{ > super(factory, "Create"); > > beanExistsCommand = factory.createBeanExistsCommand(); > > // Insert SQL > > String sql = "INSERT INTO " + jawsEntity.getTableName(); > String fieldSql = ""; > String valueSql = ""; > > Iterator it = jawsEntity.getCMPFields(); > boolean first = true; > > //Added by Vinay - Start > String rowIDColumn = jawsEntity.getRowIDColumnName(); > if(rowIDColumn==null) rowIDColumn = ""; > > > while (it.hasNext()) > { > CMPFieldMetaData cmpField = (CMPFieldMetaData)it.next(); > > if(!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) > { > fieldSql += (first ? "" : ",") + > cmpField.getColumnName(); > valueSql += first ? "?" : ",?"; > first = false; > } > } > > sql += " ("+fieldSql+") VALUES ("+valueSql+")"; > > setSQL(sql); >} > > > and > >protected void setParameters(PreparedStatement stmt, Object argOrArgs) > throws Exception >{ > EntityEnterpriseContext ctx = (EntityEnterpriseContext)argOrArgs; > int idx = 1; // Parameter-index > > Iterator iter = jawsEntity.getCMPFields(); > > String rowIDColumn = jawsEntity.getRowIDColumnName(); > if(rowIDColumn==null) rowIDColumn = ""; > > > > while (iter.hasNext()) > { > CMPFieldMetaData cmpField = (CMPFieldMetaData)iter.next(); > > if(!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) > { > Object value = getCMPFieldValue(ctx.getInstance(), cmpField); > setParameter(stmt, idx++, cmpField.getJDBCType(), value); > } > } >} > >Now in my client code I have done something like > > cl.addItemizedCall(callItem); //does the insert > calls = > cl.getAllItemizedCalls("99","07947018717","5050505050"); > > I *DO* get the row ID. I believe some things have changed in > Oracle 817 and perhaps this is one of them but I do get the ROWID > automatically without *any* additional code in the ejbPostCreate Method. > > Vinay > > > ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Ok, I've changed the JDBCCreateEntityCommand as public JDBCCreateEntityCommand(JDBCCommandFactory factory) { super(factory, "Create"); beanExistsCommand = factory.createBeanExistsCommand(); // Insert SQL String sql = "INSERT INTO " + jawsEntity.getTableName(); String fieldSql = ""; String valueSql = ""; Iterator it = jawsEntity.getCMPFields(); boolean first = true; //Added by Vinay - Start String rowIDColumn = jawsEntity.getRowIDColumnName(); if(rowIDColumn==null) rowIDColumn = ""; while (it.hasNext()) { CMPFieldMetaData cmpField = (CMPFieldMetaData)it.next(); if(!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) { fieldSql += (first ? "" : ",") + cmpField.getColumnName(); valueSql += first ? "?" : ",?"; first = false; } } sql += " ("+fieldSql+") VALUES ("+valueSql+")"; setSQL(sql); } and protected void setParameters(PreparedStatement stmt, Object argOrArgs) throws Exception { EntityEnterpriseContext ctx = (EntityEnterpriseContext)argOrArgs; int idx = 1; // Parameter-index Iterator iter = jawsEntity.getCMPFields(); String rowIDColumn = jawsEntity.getRowIDColumnName(); if(rowIDColumn==null) rowIDColumn = ""; while (iter.hasNext()) { CMPFieldMetaData cmpField = (CMPFieldMetaData)iter.next(); if(!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn)) { Object value = getCMPFieldValue(ctx.getInstance(), cmpField); setParameter(stmt, idx++, cmpField.getJDBCType(), value); } } } Now in my client code I have done something like cl.addItemizedCall(callItem); //does the insert calls = cl.getAllItemizedCalls("99","07947018717","5050505050"); I *DO* get the row ID. I believe some things have changed in Oracle 817 and perhaps this is one of them but I do get the ROWID automatically without *any* additional code in the ejbPostCreate Method. Vinay ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Fast Updates Based on Row ID
So do you build all your other applications to use rowid? -Original Message- From: K.V. Vinay Menon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 06, 2001 1:59 PM To: [EMAIL PROTECTED] Subject: Re: [JBoss-dev] Fast Updates Based on Row ID Well, We are an Oracle shop and woudl benefit [like loads of other Oracle users] from these changes. Remember they are there as an option. If you choose not to use them JAWS will work as usual. Vinay - Original Message - From: "Jay Walters" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 06, 2001 6:18 PM Subject: RE: [JBoss-dev] Fast Updates Based on Row ID > This is oracle specific as far as I know (insert...returning...). The > create problem needs to be addressed if one cannot retrieve the rowid, the > logic needs to check and see if rowid is set or not - maybe Vinay already > did this, I didn't look that hard. > > It's not clear to me what this will do for us. It is likely the index page > will have been paged into the buffer cache to handle the initial query which > returned the row so I don't see this saving a lot of disk i/o, just some cpu > cycles. For example, depending on how one is creating the keys for new rows > a better improvement might be to embed oracle specific code into the > creation to query a sequence for the key. If there is a goal to really > speed up Jaws when using Oracle or some other database we should probably > really analyze what it's doing, unless somebody is already doing that. > > Cheers > > -Original Message- > From: danch (Dan Christopherson) [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 06, 2001 12:59 PM > To: [EMAIL PROTECTED] > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > Will the 'returning into ?' work in databases other than > oracle? If not, that would be a problem: until JAWS is chainsawed > (refactored to separate SQL syntax from the Command hierarchy), it'll be > difficult to manage DB specific stuff at that level. Vinay's original > patch isn't too bad, because it doesn't cause us to generate syntax that > won't work elsewhere (you could give the name of a normal column as the > rowid column and it would work (so long as that column is unique)) > > Jay Walters wrote: > > > Use "insert ... returning rowid into ?" > > > > -Original Message- > > From: David Jencks [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, June 06, 2001 12:02 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > > > > Hi, > > > > I may be wrong about oracle rowid changing on row update, it's been a > > couple of years. However interbase/firebird dbkey definitely does change > > on update, and I think someone mentioned the sql server analogue does too. > > > > In this situation, it seems to me that commit option A cannot be used, > > since to get a valid rowid, you have to read the db within the same > > transaction you are updating in. > > > > Also, even in Oracle, how can this be used with a newly inserted bean? > > > > create --inserts row in db > > > > later in same transaction, change values on this bean, the generated save > > has no rowid unless you fetched it in perhaps ejbpostcreate??? If you can > > fix this one, perhaps it can also be used to fetch values supplied by > > triggers on insert, such as sequence/generators used for abstract id. > > > > Am I wrong here? Could you explain in detail how this will work? > > > > Thanks > > david jencks > > > > On 2001.06.06 10:50:53 -0400 K.V. Vinay Menon wrote: > > > >>The ROW ID bit does not touch ANY other portion in the JBoss source > >>except > >>for > >> > >>a) Generating SQLs > >>b) Setting parameters. > >> > >>Options A,B and C should work as usual, correct me if I am wrong. As for > >>option D, I am suprised that it has become part of our 'standard' commit > >>options. I wrote some code and never had a chance to commit it and unless > >>someone else has commited stuff for option D let me know and I'll have to > >>commit the code! > >> > >>Vinay > >>- Original Message - > >>From: "David Jencks" <[EMAIL PROTECTED]> > >>To: <[EMAIL PROTECTED]> > >>Sent: Wednesday, June 06, 2001 2:40 PM > >>Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > >> > >> > >> > >>>Hi, > >>> > >>>This looks very interesti
Re: [JBoss-dev] Fast Updates Based on Row ID
Just for the record, I don't mind having Oracle specific optimizations in JAWS, it's just that the current structure of JAWS does not really lend itself to this. Also, if you do use Oracle specific stuff for this optimization, the option in a jaws entity should be given a name that will tell users clearly that it won't work on other databases. K.V. Vinay Menon wrote: > Well, > We are an Oracle shop and woudl benefit [like loads of other Oracle > users] from these changes. Remember they are there as an option. If you > choose not to use them JAWS will work as usual. > > Vinay > - Original Message - > From: "Jay Walters" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, June 06, 2001 6:18 PM > Subject: RE: [JBoss-dev] Fast Updates Based on Row ID > > > >>This is oracle specific as far as I know (insert...returning...). The >>create problem needs to be addressed if one cannot retrieve the rowid, the >>logic needs to check and see if rowid is set or not - maybe Vinay already >>did this, I didn't look that hard. >> Confidential e-mail for addressee only. Access to this e-mail by anyone else is unauthorized. If you have received this message in error, please notify the sender immediately by reply e-mail and destroy the original communication.
Re: [JBoss-dev] Fast Updates Based on Row ID
Jay, No. Not really. Its is just that the new Oracle release clearly state advantages of using rowids for updates and it is very attractive to have that kind of a facility for updates and deletes on huge tables [we do have quite a few tables that are in excess of 5-6 million records]. The idea is to have the option at hand so that it can be used as and when required [which is going to be quite a lot]. Issues like the client accessing the bean immediately after creation are things applications take care of by design - proper transactions and a decent session facade that ensures that screw ups don't happen. Regards, Vinay - Original Message - From: "Jay Walters" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 06, 2001 7:48 PM Subject: RE: [JBoss-dev] Fast Updates Based on Row ID > So do you build all your other applications to use rowid? > > -Original Message- > From: K.V. Vinay Menon [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 06, 2001 1:59 PM > To: [EMAIL PROTECTED] > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > Well, > We are an Oracle shop and woudl benefit [like loads of other Oracle > users] from these changes. Remember they are there as an option. If you > choose not to use them JAWS will work as usual. > > Vinay > - Original Message - > From: "Jay Walters" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, June 06, 2001 6:18 PM > Subject: RE: [JBoss-dev] Fast Updates Based on Row ID > > > > This is oracle specific as far as I know (insert...returning...). The > > create problem needs to be addressed if one cannot retrieve the rowid, the > > logic needs to check and see if rowid is set or not - maybe Vinay already > > did this, I didn't look that hard. > > > > It's not clear to me what this will do for us. It is likely the index > page > > will have been paged into the buffer cache to handle the initial query > which > > returned the row so I don't see this saving a lot of disk i/o, just some > cpu > > cycles. For example, depending on how one is creating the keys for new > rows > > a better improvement might be to embed oracle specific code into the > > creation to query a sequence for the key. If there is a goal to really > > speed up Jaws when using Oracle or some other database we should probably > > really analyze what it's doing, unless somebody is already doing that. > > > > Cheers > > > > -Original Message- > > From: danch (Dan Christopherson) [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, June 06, 2001 12:59 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > > > > Will the 'returning into ?' work in databases other than > > oracle? If not, that would be a problem: until JAWS is chainsawed > > (refactored to separate SQL syntax from the Command hierarchy), it'll be > > difficult to manage DB specific stuff at that level. Vinay's original > > patch isn't too bad, because it doesn't cause us to generate syntax that > > won't work elsewhere (you could give the name of a normal column as the > > rowid column and it would work (so long as that column is unique)) > > > > Jay Walters wrote: > > > > > Use "insert ... returning rowid into ?" > > > > > > -Original Message- > > > From: David Jencks [mailto:[EMAIL PROTECTED]] > > > Sent: Wednesday, June 06, 2001 12:02 PM > > > To: [EMAIL PROTECTED] > > > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > > > > > > > Hi, > > > > > > I may be wrong about oracle rowid changing on row update, it's been a > > > couple of years. However interbase/firebird dbkey definitely does > change > > > on update, and I think someone mentioned the sql server analogue does > too. > > > > > > In this situation, it seems to me that commit option A cannot be used, > > > since to get a valid rowid, you have to read the db within the same > > > transaction you are updating in. > > > > > > Also, even in Oracle, how can this be used with a newly inserted bean? > > > > > > create --inserts row in db > > > > > > later in same transaction, change values on this bean, the generated > save > > > has no rowid unless you fetched it in perhaps ejbpostcreate??? If you > can > > > fix this one, perhaps it can also be used to fetch values supplied by > > > triggers on insert, such as s
Re: [JBoss-dev] Fast Updates Based on Row ID
Dan Ch, Well as you might have noticed the code will work as usual if the rowid-column field is not specified in jaws.xml. If it is specified, it will then be used instead of the primary key. I am not sure of how other databases work with rowids which is why jaws will still default to normal behaviour. Do you think we are in a position to submit the source? I'd have rather sent the modified source files for peer review in case I have goofed up! And *then* committed changes. Do you have the time to spare? Regards, Vinay - Original Message - From: "danch (Dan Christopherson)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 06, 2001 9:08 PM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > Just for the record, I don't mind having Oracle specific optimizations > in JAWS, it's just that the current structure of JAWS does not really > lend itself to this. Also, if you do use Oracle specific stuff for this > optimization, the option in a jaws entity should be given a name that > will tell users clearly that it won't work on other databases. > > K.V. Vinay Menon wrote: > > > Well, > > We are an Oracle shop and woudl benefit [like loads of other Oracle > > users] from these changes. Remember they are there as an option. If you > > choose not to use them JAWS will work as usual. > > > > Vinay > > - Original Message - > > From: "Jay Walters" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, June 06, 2001 6:18 PM > > Subject: RE: [JBoss-dev] Fast Updates Based on Row ID > > > > > > > >>This is oracle specific as far as I know (insert...returning...). The > >>create problem needs to be addressed if one cannot retrieve the rowid, the > >>logic needs to check and see if rowid is set or not - maybe Vinay already > >>did this, I didn't look that hard. > >> > > > ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Fast Updates Based on Row ID
Just to confirm what Jay is saying... I was recently at an Oracle workshop, and since the rowid isn't part of the ANSI SQL standard and is a proprietary pseudo column, they warned us again using it in building applications. They said, the improvements could be wiped out in a future release of the software. --- Jay Walters <[EMAIL PROTECTED]> wrote: > Oracle doesn't move rows unless you reorganize the > database. If a row grows > so as to no longer fit in it's current block, then > the block is chained > (essentially another physical block is added and the > two make one bigger > logical block) and the row just expands into the new > space with no change of > rowid. Note that chained blocks are not a good > thing. I believe that rowids > will work fine for what Vinay is trying to do with > them. Of course this is > always subject to change if Oracle changes the way > the database works. > > That being said, in all the time I've used Oracle > (15 years) I've never gone > down this path of using the rowid. For some reason > I have a deep distrust > of this strategy. Perhaps it was when I was an > Oracle consultant and > advised people against doing it. Who knows. > > Cheers > > -Original Message- > From: K.V. Vinay Menon [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 06, 2001 10:49 AM > To: [EMAIL PROTECTED] > Subject: Re: [JBoss-dev] Fast Updates Based on Row > ID > > > Locks will be in place since the rowid stuff is > applicable only for updates > and deletes. selects obviously cannot work with > this! Also, to the best of > my knowledge Oracle row ids are fixed unless you > move them to new db i.e. > export or stuff. > > Vinay > ----- Original Message ----- > From: "Georg Rehfeld" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, June 06, 2001 2:57 PM > Subject: Re: [JBoss-dev] Fast Updates Based on Row > ID > > > > Hi Vinay, > > > > as far as I can remember from my Oracle times > using the ROWID is > > only allowed inside transactions and when you got > the row with > > SELECT ... FOR UPDATE else the ROWID isn't fixed, > but may change, > > when other clients update the row (at least when > the update > > causes the row to be moved to another block in the > DB, as the > > ROWID in Oracle is the physical address of the > row). > > > > I havn't the docs handy, if you have them online, > then you might > > search for ROWID until you find that precondition, > sorry, but I'm > > pretty sure it exists. > > > > In your code I couldn't find checks for either, at > least the > > JAWS option should be > available and checked > > for true, migth be this is enough checking there, > as select for > > update is valid inside transactions only anyway. > > > > regards > > Georg > > ___ ___ > > | + | |__Georg Rehfeld Woltmanstr. 12 > 20097 Hamburg > > |_|_\ |___ [EMAIL PROTECTED] +49 > (40) 23 53 27 10 > > > > > > > > ___ > > Jboss-development mailing list > > [EMAIL PROTECTED] > > > http://lists.sourceforge.net/lists/listinfo/jboss-development > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/ ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Dear Vinay, > No. Not really. Its is just that the new Oracle release clearly state > advantages of using rowids for updates and it is very attractive to have > that kind of a facility for updates and deletes on huge tables [we do have > quite a few tables that are in excess of 5-6 million records]. The idea is > to have the option at hand so that it can be used as and when required > [which is going to be quite a lot]. Agreed. > Issues like the client accessing the bean immediately after creation are > things applications take care of by design - proper transactions and a > decent session facade that ensures that screw ups don't happen. would be better your code would check for a null or empty rowIDValue and then fall back to using the PK field(s), so it would be safe even after create! (Tried to find that in your source on the list, couldn't find that check, but may me I'm too tired yet). regards Georg ___ ___ | + | |__Georg Rehfeld Woltmanstr. 12 20097 Hamburg |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10 ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
K.V. Vinay Menon wrote: > Dan Ch, > Well as you might have noticed the code will work as usual if the > rowid-column field is not specified in jaws.xml. If it is specified, it will > then be used instead of the primary key. I am not sure of how other > databases work with rowids which is why jaws will still default to normal > behaviour. I think i'd rather have a flag on the JAWS entity to turn on 'oracle-tuned-updates' than just indicating the name of the rowid column. That way people will be less likely to turn it on for other databases. > Do you think we are in a position to submit the source? I'd have rather > sent the modified source files for peer review in case I have goofed up! > And *then* committed changes. Do you have the time to spare? I think we've gotten a pretty good peer review already. However, with the insert issue and the change Georg points out later (detect empty rowIDValue and fall back on primary key) I think you should probably work those ideas into the code and post again. Are you on the JBossCMP mailing list? Perhaps we should move this discussion there. ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Fast Updates Based on Row ID
If you do this then maybe you can extend the patch to include the insert...returning construct Just say you need Oracle8 to use this feature. Maybe you could also modify the SQL to not change the primary key field. I'll bet if you use a lot of referential integrity constraints this will speed things up more than the ROWID stuff. I thought Jaws was somehow setup using factories so one could just make a new set of modules for Oracle without too much pain. Sounds like this is not the case. How much work would it be to do this? Cheers -Original Message- From: danch To: [EMAIL PROTECTED] Sent: 6/7/01 1:32 AM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID K.V. Vinay Menon wrote: > Dan Ch, > Well as you might have noticed the code will work as usual if the > rowid-column field is not specified in jaws.xml. If it is specified, it will > then be used instead of the primary key. I am not sure of how other > databases work with rowids which is why jaws will still default to normal > behaviour. I think i'd rather have a flag on the JAWS entity to turn on 'oracle-tuned-updates' than just indicating the name of the rowid column. That way people will be less likely to turn it on for other databases. > Do you think we are in a position to submit the source? I'd have rather > sent the modified source files for peer review in case I have goofed up! > And *then* committed changes. Do you have the time to spare? I think we've gotten a pretty good peer review already. However, with the insert issue and the change Georg points out later (detect empty rowIDValue and fall back on primary key) I think you should probably work those ideas into the code and post again. Are you on the JBossCMP mailing list? Perhaps we should move this discussion there. ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Will put in checks for null rowids. Need to figure out a way of changing the inserts as well. Will probably be only tomorrow though. Vinay - Original Message - From: "danch" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 07, 2001 6:32 AM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > K.V. Vinay Menon wrote: > > > Dan Ch, > > Well as you might have noticed the code will work as usual if the > > rowid-column field is not specified in jaws.xml. If it is specified, it will > > then be used instead of the primary key. I am not sure of how other > > databases work with rowids which is why jaws will still default to normal > > behaviour. > > I think i'd rather have a flag on the JAWS entity to turn on > 'oracle-tuned-updates' than just indicating the name of the rowid > column. That way people will be less likely to turn it on for other > databases. > > > > Do you think we are in a position to submit the source? I'd have rather > > sent the modified source files for peer review in case I have goofed up! > > And *then* committed changes. Do you have the time to spare? > > I think we've gotten a pretty good peer review already. However, with > the insert issue and the change Georg points out later (detect empty > rowIDValue and fall back on primary key) I think you should probably > work those ideas into the code and post again. Are you on the JBossCMP > mailing list? Perhaps we should move this discussion there. > > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Hi, At 15:46 6.6.2001 +0100, you wrote: >Have not submitted the patch as yet. I'll check it in once people think >its alright. Do you want me to send you complete source files for the >changes? I think unified diffs are the most convenient to use. If you're on W2k (I seem to remember so) install Cygwin, use 'diff' to create the patch file so others can use 'patch' to make sure all the changes get in. (or maybe w2k already has these?) It's very easy and very convenient. -- Juha ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Hi, >Options A,B and C should work as usual, correct me if I am wrong. As for >option D, I am suprised that it has become part of our 'standard' commit >options. I wrote some code and never had a chance to commit it and unless >someone else has commited stuff for option D let me know and I'll have to >commit the code! The Option D is in the CVS. It was committed by Doug Ferguson (another training, same lab). -- Juha ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Have started looking at the code again, Do we want to specifically say 'oracle-tuned-updates'. What if actually proves useful for some other database - can't we just call it just 'rowid-column' and use the presence or absence of the tag to use rowid based updates? Vinay - Original Message - From: "danch" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 07, 2001 6:32 AM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > K.V. Vinay Menon wrote: > > > Dan Ch, > > Well as you might have noticed the code will work as usual if the > > rowid-column field is not specified in jaws.xml. If it is specified, it will > > then be used instead of the primary key. I am not sure of how other > > databases work with rowids which is why jaws will still default to normal > > behaviour. > > I think i'd rather have a flag on the JAWS entity to turn on > 'oracle-tuned-updates' than just indicating the name of the rowid > column. That way people will be less likely to turn it on for other > databases. > > > > Do you think we are in a position to submit the source? I'd have rather > > sent the modified source files for peer review in case I have goofed up! > > And *then* committed changes. Do you have the time to spare? > > I think we've gotten a pretty good peer review already. However, with > the insert issue and the change Georg points out later (detect empty > rowIDValue and fall back on primary key) I think you should probably > work those ideas into the code and post again. Are you on the JBossCMP > mailing list? Perhaps we should move this discussion there. > > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Dear Vinay, > Have started looking at the code again, > Do we want to specifically say 'oracle-tuned-updates'. What if actually > proves useful for some other database - can't we just call it just > 'rowid-column' and use the presence or absence of the tag to use rowid based > updates? What about 'stable-rowid-column' and a good comment and documentation? regards Georg ___ ___ | + | |__Georg Rehfeld Woltmanstr. 12 20097 Hamburg |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10 ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
I tried to send this out earlier today, but it never showed up (trouble on my end) The reason I was suggesting an oracle specific option name was because I really think that we need to use the Oracle specific syntax to return the rowid value on inserts. Georg Rehfeld wrote: > Dear Vinay, > > >> Have started looking at the code again, >> Do we want to specifically say 'oracle-tuned-updates'. What if > > actually > >> proves useful for some other database - can't we just call it just >> 'rowid-column' and use the presence or absence of the tag to use rowid > > based > >> updates? > > > What about 'stable-rowid-column' and a good comment and documentation? > > regards > Georg > ___ ___ > | + | |__Georg Rehfeld Woltmanstr. 12 20097 Hamburg > |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10 > > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Hi Dan and Vinay, > The reason I was suggesting an oracle specific option name was because I > really think that we need to use the Oracle specific syntax to return > the rowid value on inserts. Oops, I forgot about that. But Vinay is right, a stable ROWID might be present in several other databases already or in future. The 'insert ... select into' syntax today seems to be Oracle 8 specific (remember, Oracle 7 does not have it), but could make it into some standard? At least one and the other are not too closely related, this syntax especially can get back whatever you want from the just inserted row, not only the ROWID, but even some sequence value, some expression list to be more general. And other DB's having a stable ROWID ain't lost, as Vinay's code now falls back to the PK when a ROWID value isn't available. So I suggest 'stable-rowid-column' (including good docs) and a new tag 'insert-select-list' specifying a comma separated list of expressions to select from the inserted row and an appropriate number of placeholders for the result after a semicolon. (Or better, feel free to define the syntax, you got the idea). bye, my very best regards Georg ___ ___ | + | |__Georg Rehfeld Woltmanstr. 12 20097 Hamburg |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10 ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
Georg, Dan Alright. First of all do we really want to modify the insert sql to return the oracle rowid and hence end up putting oracle specific code. Believe the only issue we have is that given the fact that updates will be based on the row id and immediately after inserts the rowid would still be null we might end up with a few problems. Now, that is where I think we need to make the documentation work. If a person wishes to use rowid based updates etc then it must be clearly stated that the create method be defined in a container transaction that has value 'RequiresNew'. That way, the insert would be committed immediately and even if the person did an update after the insert it would basically have the rowid value updated. I am just trying to avoid putting in code that is specific to any dbms - just require that a dbms provide stable rowids. Do you see a problem with this? My views. Your thoughts? Vinay - Original Message - From: "Georg Rehfeld" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, June 09, 2001 5:40 AM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > Hi Dan and Vinay, > > > The reason I was suggesting an oracle specific option name was because I > > really think that we need to use the Oracle specific syntax to return > > the rowid value on inserts. > > Oops, I forgot about that. But Vinay is right, a stable ROWID > might be present in several other databases already or in future. > > The 'insert ... select into' syntax today seems to be Oracle 8 > specific (remember, Oracle 7 does not have it), but could make it > into some standard? At least one and the other are not too closely > related, this syntax especially can get back whatever you want > from the just inserted row, not only the ROWID, but even some > sequence value, some expression list to be more general. > > And other DB's having a stable ROWID ain't lost, as Vinay's code > now falls back to the PK when a ROWID value isn't available. > > So I suggest 'stable-rowid-column' (including good docs) and > a new tag 'insert-select-list' specifying a comma separated list > of expressions to select from the inserted row and an appropriate > number of placeholders for the result after a semicolon. > (Or better, feel free to define the syntax, you got the idea). > > bye, my very best regards > Georg > ___ ___ > | + | |__Georg Rehfeld Woltmanstr. 12 20097 Hamburg > |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10 > > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
RE: [JBoss-dev] Fast Updates Based on Row ID
Why do you think the rowid won't be immediately available? -Original Message- From: K.V. Vinay Menon To: [EMAIL PROTECTED] Sent: 6/9/01 11:47 AM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID Georg, Dan Alright. First of all do we really want to modify the insert sql to return the oracle rowid and hence end up putting oracle specific code. Believe the only issue we have is that given the fact that updates will be based on the row id and immediately after inserts the rowid would still be null we might end up with a few problems. Now, that is where I think we need to make the documentation work. If a person wishes to use rowid based updates etc then it must be clearly stated that the create method be defined in a container transaction that has value 'RequiresNew'. That way, the insert would be committed immediately and even if the person did an update after the insert it would basically have the rowid value updated. I am just trying to avoid putting in code that is specific to any dbms - just require that a dbms provide stable rowids. Do you see a problem with this? My views. Your thoughts? Vinay - Original Message - From: "Georg Rehfeld" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, June 09, 2001 5:40 AM Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > Hi Dan and Vinay, > > > The reason I was suggesting an oracle specific option name was because I > > really think that we need to use the Oracle specific syntax to return > > the rowid value on inserts. > > Oops, I forgot about that. But Vinay is right, a stable ROWID > might be present in several other databases already or in future. > > The 'insert ... select into' syntax today seems to be Oracle 8 > specific (remember, Oracle 7 does not have it), but could make it > into some standard? At least one and the other are not too closely > related, this syntax especially can get back whatever you want > from the just inserted row, not only the ROWID, but even some > sequence value, some expression list to be more general. > > And other DB's having a stable ROWID ain't lost, as Vinay's code > now falls back to the PK when a ROWID value isn't available. > > So I suggest 'stable-rowid-column' (including good docs) and > a new tag 'insert-select-list' specifying a comma separated list > of expressions to select from the inserted row and an appropriate > number of placeholders for the result after a semicolon. > (Or better, feel free to define the syntax, you got the idea). > > bye, my very best regards > Georg > ___ ___ > | + | |__Georg Rehfeld Woltmanstr. 12 20097 Hamburg > |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10 > > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
Re: [JBoss-dev] Fast Updates Based on Row ID
The rowid will not be immediately available in the postcreate method. have not been able to simulate a condition where it will not be available when it will not be available apart from that which is why I do not really want to change insert statements etc. Vinay - Original Message - From: "Jay Walters" <[EMAIL PROTECTED]> To: "'K.V. Vinay Menon '" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Saturday, June 09, 2001 5:16 PM Subject: RE: [JBoss-dev] Fast Updates Based on Row ID > Why do you think the rowid won't be immediately available? > > -Original Message- > From: K.V. Vinay Menon > To: [EMAIL PROTECTED] > Sent: 6/9/01 11:47 AM > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > Georg, Dan > > Alright. First of all do we really want to modify the insert sql to > return > the oracle rowid and hence end up putting oracle specific code. Believe > the > only issue we have is that given the fact that updates will be based on > the > row id and immediately after inserts the rowid would still be null we > might > end up with a few problems. Now, that is where I think we need to make > the > documentation work. If a person wishes to use rowid based updates etc > then > it must be clearly stated that the create method be defined in a > container > transaction that has value 'RequiresNew'. That way, the insert would be > committed immediately and even if the person did an update after the > insert > it would basically have the rowid value updated. I am just trying to > avoid > putting in code that is specific to any dbms - just require that a dbms > provide stable rowids. Do you see a problem with this? > > My views. Your thoughts? > > Vinay > - Original Message - > From: "Georg Rehfeld" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, June 09, 2001 5:40 AM > Subject: Re: [JBoss-dev] Fast Updates Based on Row ID > > > > Hi Dan and Vinay, > > > > > The reason I was suggesting an oracle specific option name was > because I > > > really think that we need to use the Oracle specific syntax to > return > > > the rowid value on inserts. > > > > Oops, I forgot about that. But Vinay is right, a stable ROWID > > might be present in several other databases already or in future. > > > > The 'insert ... select into' syntax today seems to be Oracle 8 > > specific (remember, Oracle 7 does not have it), but could make it > > into some standard? At least one and the other are not too closely > > related, this syntax especially can get back whatever you want > > from the just inserted row, not only the ROWID, but even some > > sequence value, some expression list to be more general. > > > > And other DB's having a stable ROWID ain't lost, as Vinay's code > > now falls back to the PK when a ROWID value isn't available. > > > > So I suggest 'stable-rowid-column' (including good docs) and > > a new tag 'insert-select-list' specifying a comma separated list > > of expressions to select from the inserted row and an appropriate > > number of placeholders for the result after a semicolon. > > (Or better, feel free to define the syntax, you got the idea). > > > > bye, my very best regards > > Georg > > ___ ___ > > | + | |__Georg Rehfeld Woltmanstr. 12 20097 Hamburg > > |_|_\ |___ [EMAIL PROTECTED] +49 (40) 23 53 27 10 > > > > > > > > ___ > > Jboss-development mailing list > > [EMAIL PROTECTED] > > http://lists.sourceforge.net/lists/listinfo/jboss-development > > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development > > ___ > Jboss-development mailing list > [EMAIL PROTECTED] > http://lists.sourceforge.net/lists/listinfo/jboss-development ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development