You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Jakob Braeuchi <jb...@gmx.ch> on 2003/01/19 12:59:28 UTC

extent aware pathExpressions fixed

hi all,

ojb now provides better support for extent aware path expression. only 
one sql is executed.
the sql containins one 'outer join' for each extent and one 'or' for 
each criteria:

SELECT DISTINCT A0.KategorieName,A0.Kategorie_Nr,A0.Beschreibung FROM
Kategorien A0
LEFT OUTER JOIN Artikel A1 ON A0.Kategorie_Nr=A1.Kategorie_Nr
LEFT OUTER JOIN BOOKS A1E0 ON A0.Kategorie_Nr=A1E0.Kategorie_Nr
LEFT OUTER JOIN CDS A1E1 ON A0.Kategorie_Nr=A1E1.Kategorie_Nr
WHERE
A1.Artikelname LIKE  'F%'  OR
A1E0.Artikelname LIKE  'F%'  OR
A1E1.Artikelname LIKE  'F%'

this sql returns all productgroups having an article named 'F%' (article 
has extents Books and CDs). above statement is produced by the following 
simple query:

        Criteria crit = new Criteria();
        crit.addLike("allArticlesInGroup.articleName", "F%");

        Query q = QueryFactory.newQuery(ProductGroup.class, crit, true);
        Iterator iter = broker.getIteratorByQuery(q);

there are some issues with FieldCriteria (criteria referencing another 
field of a class) because the referenced field may also be extent aware.

jakob

>  
>


Scrollable Resultsets in JdbcAccess

Posted by lc...@gmx.net.
hi!

is anybody able to answer my question? i posted it some times ago, but
obviously nobody
could react. i think matthew has made the change. could you help me out? 

regards,
liang  

> hi!
> 
> As of OJB 0.9.8 the scrollable flag in method JDBCAccess.executeSQL() has
> been set from 
> Query.SCROLLABLE to Query.NOT_SCROLLABLE, which causes RsIterator.size()
> always to
> use count(*) method to determine the size although the JDBC driver
> supports
> it.
> 
> 	public int size() throws PersistenceBrokerException
> 	{
> 		int retval = 0; // default size is 0;
> 		boolean forwardOnly = true;
> 		try
> 		{
> # forwardOnly flag yields true			forwardOnly =
> m_rsAndStmt.m_stmt.getResultSetType() == ResultSet.TYPE_FORWARD_ONLY;
> 		}
> 		catch (SQLException e)
> 		{
> 		}
> 		if (!supportsAdvancedJDBCCursorControl()
> 			||
>
PlatformFactory.getPlatformFor(m_cld.getConnectionDescriptor()).useCountForResultsetSize()
> 			|| forwardOnly)
> 		{
> 			/**
> 			 * MBAIRD: doesn't support the .last .getRow method, use the .getCount
> on
> the
> 			 * persistenceBroker which executes a count(*) query.
> 			 */
> 			if (logger.isDebugEnabled()) logger.debug("Executing count(*) to get
> size()");
> 			retval = countedSize();
> 		}
> 		else
> 		...
> 
> Why has to been changed and how can i force size() not to take the
> count(*)
> method?
> 
> thanks,
> 
> Liang Cheng

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!


Scrollable Resultsets in JdbcAccess

Posted by lc...@gmx.net.
hi!

As of OJB 0.9.8 the scrollable flag in method JDBCAccess.executeSQL() has
been set from 
Query.SCROLLABLE to Query.NOT_SCROLLABLE, which causes RsIterator.size()
always to
use count(*) method to determine the size although the JDBC driver supports
it.

	public int size() throws PersistenceBrokerException
	{
		int retval = 0; // default size is 0;
		boolean forwardOnly = true;
		try
		{
# forwardOnly flag yields true			forwardOnly =
m_rsAndStmt.m_stmt.getResultSetType() == ResultSet.TYPE_FORWARD_ONLY;
		}
		catch (SQLException e)
		{
		}
		if (!supportsAdvancedJDBCCursorControl()
			||
PlatformFactory.getPlatformFor(m_cld.getConnectionDescriptor()).useCountForResultsetSize()
			|| forwardOnly)
		{
			/**
			 * MBAIRD: doesn't support the .last .getRow method, use the .getCount on
the
			 * persistenceBroker which executes a count(*) query.
			 */
			if (logger.isDebugEnabled()) logger.debug("Executing count(*) to get
size()");
			retval = countedSize();
		}
		else
		...

Why has to been changed and how can i force size() not to take the count(*)
method?

thanks,

Liang Cheng

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!


Re: extent aware pathExpressions fixed

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
On Sun, 2003-01-19 at 09:59, Jakob Braeuchi wrote:
> hi all,
> 
> ojb now provides better support for extent aware path expression. only 
> one sql is executed.
> the sql containins one 'outer join' for each extent and one 'or' for 
> each criteria:
> 
> SELECT DISTINCT A0.KategorieName,A0.Kategorie_Nr,A0.Beschreibung FROM
> Kategorien A0
> LEFT OUTER JOIN Artikel A1 ON A0.Kategorie_Nr=A1.Kategorie_Nr
> LEFT OUTER JOIN BOOKS A1E0 ON A0.Kategorie_Nr=A1E0.Kategorie_Nr
> LEFT OUTER JOIN CDS A1E1 ON A0.Kategorie_Nr=A1E1.Kategorie_Nr
> WHERE
> A1.Artikelname LIKE  'F%'  OR
> A1E0.Artikelname LIKE  'F%'  OR
> A1E1.Artikelname LIKE  'F%'
> 
> this sql returns all productgroups having an article named 'F%' (article 
> has extents Books and CDs). above statement is produced by the following 
> simple query:
> 
>         Criteria crit = new Criteria();
>         crit.addLike("allArticlesInGroup.articleName", "F%");
> 
>         Query q = QueryFactory.newQuery(ProductGroup.class, crit, true);
>         Iterator iter = broker.getIteratorByQuery(q);
> 
> there are some issues with FieldCriteria (criteria referencing another 
> field of a class) because the referenced field may also be extent aware.

Nice work :-)

> 
> jakob
> 
> >  
> >
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
-- 
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e Servicos (IB)
http://www.ibnetwork.com.br
http://jakarta.apache.org/ojb