db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: SPs and OJB-22, Re: OJB 1.0 to 1.1 Migration Experience
Date Wed, 11 May 2005 13:35:38 GMT
Ping?

Vadim

Vadim Gritsenko wrote:
> Jakob Braeuchi wrote:
> 
>> hi vadim,
> 
> 
> Hi Jacob,
> 
> 
>> thanks for the feedback. i think we should add this to a 'migration 
>> howto'.
> 
> 
> Yes, feel free to add it wherever :)
> 
> 
>> btw. i commited a patch optimize the select when querying for proxies. 
>> it selects the pks only. the patch does not yet support stored 
>> procedures, actually i do not know if it should ?
> 
> 
> There are situations when an application has no "direct" access to the 
> database (no SELECT / UPDATE / INSERT / DELETE statements allowed), and 
> it can use only stored procedures for data access. In order to be able 
> to use OJB in such situations, OJB should always use stored procedure 
> calls. For example, currently, if stored procedure for retrieval by fk 
> is set, batch retrieval is turned off (because it uses SELECT ... WHERE 
> ID IN (1, 2, ...) statement which is not trivial to do with stored 
> procedures). So at the cost of some slowdown, it's possible to use OJB 
> when "direct" database access is not allowed.
> 
> 
>> could you please have a look at 
>> SqlGeneratorDefaultImpl#getPreparedSelectPkStatement
> 
> 
> I can suggest two ways of making it work with stored procedures:
> 
>   * Use selectByPkStatement if stored procedure is configured,
>     similar to getPreparedSelectStatement:
> 
>   public String getPreparedSelectPkStatement(Query query, 
> ClassDescriptor cld)
>   {
>       ProcedureDescriptor pd = cld.getSelectByFKProcedure();
>       SqlStatement sql;
> 
>       if ((query instanceof QueryByExample) && (pd != null))
>       {
>           // Special case for QueryByExample and SelectByFKProcedure
>           sql = new SqlProcedureFKStatement(pd, (QueryByExample)query, 
> m_logger);
>       }
>       else
>       {
>           // All other queries
>           sql = new SqlSelectPkStatement(m_platform, m_logger, cld, query);
>       }
> 
>       return sql.getStatement();
>    }
> 
> 
>   * Add third type of procedure for selecting PKs only.
>     This means you'd have to have 3 procedures per each class.
> 
> 
> First option, AFAICS, should result in same stored procedures 
> functionality as it was before the OJB-22 patch.
> 
> 
> Regards,
> Vadim


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message