Well, one person thought adding "select for update" on Entity Loading to 
JAWS would be useful so I looked into it.  It's a rather simple change 
if anybody thinks it worth adding to CVS(I don't have rw access).  I 
thought it would be useful to be able to turn "select for update" on or 
off for specific entity beans.  It can be turned off/on the same way 
tuned-updates or read-only can be turned off/on.  The xml tag I selected 
was <select-for-update>.  If read-only is turned on select-for-update 
will always resolve as false.

Bill

In org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand
change the constructor adding this code to the end

   sql += " FROM "
       + jawsEntity.getTableName()
       + " WHERE "
       + getPkColumnWhereList();
//--start new code
   if (jawsEntity.hasSelectForUpdate())
   {
       sql += " FOR UPDATE";
   }
//--end new code
   setSQL(sql);

In org.jboss.ejb.plugins.jaws.metadata.JawsEntityMetaData
1. Add a member variable
private boolean selectForUpdate;

2. Change importXML()

       // read only?  If not provided, keep default.
       String roStr = getElementContent(getOptionalChild(element, 
"read-only"));
       if (roStr != null) readOnly = Boolean.valueOf(roStr).booleanValue();
      
       //---start new code
       String sForUpStr = getElementContent(getOptionalChild(element, 
"select-for-update"));
       if (sForUpStr != null) selectForUpdate = 
(Boolean.valueOf(sForUpStr).booleanValue()) && !readOnly;
       //---end new code

3. add accessor for selectForUpdate
public boolean hasSelectForUpdate() { return selectForUpdate; }



_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to