Hi,
 
 I would like to generate to generate SQL select statements for DB2 in a
 managed environment (JBoss). All Select Statements should be extended by
 "for read only". I found that it is possible to hardcode this at 
 
 org.apache.ojb.broker.accesslayer.sql.SqlSelectStatement
 
 at 
 
 buildStatement()
 
 There I added : 
 
         if(!hasParent())
         {
                stmt.append(" FOR READ ONLY");
         }
 
 at the end where hasParent is another modification at 
 
 org.apache.ojb.broker.accesslayer.sql.SqlQueryStatement
 
     protected boolean hasParent()
     {
        return m_parentStatement==null?false:true;
     }
 
 This is for avoiding 'for read only' when the select statement is a sub
 statement of an other sql statement. The clause can not be used in sub
 queries like 'in ( select x from y)'.
 This is working but is not very useable and it is platform dependent. So the
 modified OJB Version won't work with other databases. I would like to
 implement a better platform dependent solution. Is there a way to get the
 platform when running in a managed environment? Is there a existing better
 way to implement it or a better way to generate platform dependent SQL? The
 second thing is, why m_parentStatement is set when executing selects by
 primary key during insert/update statement execution? I found that these
 selects were not extended and the reason was that m_parentStatement was set
 althoug the select statement is not executed as sub select but as identity
 select.
 Thanks in advance, 
 
 best regards,
 
 Guido


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to