db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: query Criteria: per path-segment alias
Date Thu, 20 May 2004 09:24:36 GMT
hi phil,

imo you did it right. but i cannot aply it. may be it's a problem with the 
eclipse versions. i use Version: 3.0.0 Build id: 200405140800

btw: PathTest.java and SqlQueryStatement.java are missing.

jakob

Phil Warrick wrote:

> Jakob,
> 
>> thanks for these patches. unfortunately i cannot apply them because 
>> eclipse does not find all matches and therefore some methods are missing.
>> could you please send me the patches as separate files or your patches 
>> files ?
> 
> 
> Sorry, I thought I had created good patches with eclipse this time. What 
> do I need to do to get this right?  I created an eclipse project from a 
> cvs head source.  Then I applied my changes to the /src subtree.  Then I 
> chose the /src/java/o.a.o.b.query directory and created a patch to 
> clipboard  (Team | Create Patch) and pasted into my email text.  I did 
> the same for individual files PathTest.java and SqlQueryStatement.java.
> 
> In the meantime I've attached the sources. Part 1 of 2.
> 
> Phil
> 
> 
> ------------------------------------------------------------------------
> 
> package org.apache.ojb.broker.query;
> 
> import java.util.Collection;
> 
> /* Copyright 2002-2004 The Apache Software Foundation
>  *
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  *
>  *     http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> 
> /**
>  * SelectionCriteria for 'in (a,b,c..)'
>  * 
>  * @author <a href="mailto:jbraeuchi@hotmail.com">Jakob Braeuchi</a>
>  * @version $Id: InCriteria.java,v 1.10 2004/04/04 23:53:36 brianm Exp $
>  */
> public class InCriteria extends ValueCriteria
> {
> 	InCriteria(Object anAttribute, Object aValue, String aClause, String anAlias)
> 	{
> 		super(anAttribute, aValue, aClause, anAlias);
> 	}
>  
> 	// PAW
> 	InCriteria(Object anAttribute, Object aValue, String aClause, UserAlias anAlias)
> 	{
> 		super(anAttribute, aValue, aClause, anAlias);
> 	}
>  
> 	/**
> 	 * @see org.apache.ojb.broker.query.SelectionCriteria#isBindable()
> 	 * BRJ: empty Collection is bindable
> 	 */
> 	protected boolean isBindable()
> 	{
> 		if (getValue() instanceof Collection)
> 		{
> 			Collection coll = (Collection)getValue();
> 			return coll.isEmpty();
> 		}	
> 		else
> 		{
> 			return true;
> 		}	
> 	}
> 
> }
> 
> 
> 
> ------------------------------------------------------------------------
> 
> /* Copyright 2002-2004 The Apache Software Foundation
>  *
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  *
>  *     http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> 
> package org.apache.ojb.broker.query;
> 
> /**
>  * Model a Like Criteria</br> 
>  * Escape Processing by Paul R. Nase 
>  * <p>
>  * The pattern string is a simple pattern string using % or * as a wildcard.
>  * So Ander* would match Anderson and Anderton. The _ or ? character is used to match a single occurence
>  * of a character. The '\' is used to escape the wildcard characters so that we can search for
>  * strings containing * and ?. 
>  * <p>
>  * To change the escape character use setEscapeCharacter. 
>  * @see LikeCriteria#setEscapeCharacter(char)
>  * 
>  * @author <a href="mailto:jbraeuchi@gmx.ch">Jakob Braeuchi </a>
>  * @author <a href="mailto:Nase.Paul@mayo.edu">Paul Nase </a>
>  * @version $Id: LikeCriteria.java,v 1.8 2004/04/04 23:53:36 brianm Exp $
>  */
> public class LikeCriteria extends ValueCriteria
> {
> 
> 	/**
> 	 * @param anAttribute
> 	 * @param aValue
> 	 * @param aClause
> 	 * @param anAlias
> 	 */
> 	public LikeCriteria(Object anAttribute, Object aValue, String aClause, String anAlias)
> 	{
> 		super(anAttribute, generateSQLSearchPattern((String) aValue), aClause, anAlias);
> 	}
> 
> 	/**
> 	 * @param anAttribute
> 	 * @param aValue
> 	 * @param aClause
> 	 * @param aUserAlias
> 	 */
> 	// PAW
> 	public LikeCriteria(Object anAttribute, Object aValue, String aClause, UserAlias anAlias)
> 	{
> 		super(anAttribute, generateSQLSearchPattern((String) aValue), aClause, anAlias);
> 	}
> 
>     /**
>      * The Character used for Escaping Wildcards
>      */
>     private static char escapeCharacter = '\\';
> 
>     /**
>      * Generate a SQL search string from the pattern string passed. 
>      * The pattern string is a simple pattern string using % or * as a wildcard. 
>      * So Ander* would match Anderson and Anderton. The _ or ? character is used to match a single occurence
>      * of a character. The escapeCharacter is used to escape the wildcard characters so that we can search for
>      * strings containing * and ?. This method converts the criteria wildcard strings to SQL wildcards.
>      * 
>      * @param pattern a criteria search pattern containing optional wildcards
>      * @return a SQL search pattern string with all escape codes processed.
>      */
> 	private static String generateSQLSearchPattern(String pattern)
> 	{
> 		if (pattern == null)
> 		{
> 			return null;
> 		}
> 		else
> 		{
> 			StringBuffer sqlpattern = new StringBuffer();
> 			char[] chars = pattern.toCharArray();
> 
> 			for (int i = 0; i < chars.length; i++)
> 			{
> 				if (chars[i] == escapeCharacter)
> 				{
> 					// for the escape character add the next char as is.
> 					// find the next non-escape character.
> 					int x = i + 1;
> 					for (;(x < chars.length); x++)
> 					{
> 						if (chars[x] != escapeCharacter)
> 						{
> 							break;
> 						}
> 					}
> 					boolean oddEscapes = (((x - i) % 2) > 0) ? true : false;
> 					if (oddEscapes)
> 					{
> 						// only escape characters allowed are '%', '_', and '\'
> 						// if the escaped character is a '\', then oddEscapes
> 						// will be false.
> 						// if the character following this last escape is not a
> 						// '%' or an '_', eat this escape character.
> 						if ((x < chars.length)
> 							&& ((chars[x] == '%') || (chars[x] == '_')))
> 						{
> 							// leave the escape character in, along with the following char
> 							x++;
> 						}
> 						else
> 						{
> 							// remove the escape character, will cause problems in sql statement.
> 							i++; // removing the first escape character.
> 							if ((x < chars.length)
> 								&& ((chars[x] == '*') || (chars[x] == '?')))
> 							{
> 								// but if it is a '*' or a '?', we want to keep these
> 								// characters as is, they were 'escaped' out.
> 								x++; // include the first non-escape character.
> 							}
> 						}
> 					}
> 					if (i < chars.length)
> 					{
> 						sqlpattern.append(chars, i, x - i);
> 					}
> 					i = x - 1; // set index to last character copied.
> 				}
> 				else if (chars[i] == '*')
> 				{
> 					sqlpattern.append("%");
> 				}
> 				else if (chars[i] == '?')
> 				{
> 					sqlpattern.append("_");
> 				}
> 				else
> 				{
> 					sqlpattern.append(chars[i]);
> 				}
> 			}
> 			return sqlpattern.toString();
> 		}
> 	}
> 
>     /**
>      * @return Returns the escapeCharacter.
>      */
>     public static char getEscapeCharacter()
>     {
>         return escapeCharacter;
>     }
>     
>     /**
>      * Global change of the escapeCharacter
>      * @param escapeCharacter The escapeCharacter to set.
>      */
>     public static void setEscapeCharacter(char escapeCharacter)
>     {
>         LikeCriteria.escapeCharacter = escapeCharacter;
>     }
> }
> 
> 
> ------------------------------------------------------------------------
> 
> package org.apache.ojb.broker.query;
> 
> /* Copyright 2002-2004 The Apache Software Foundation
>  *
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  *
>  *     http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> 
> /**
>  * SelectionCriteria for 'is null' and 'is not null'
>  * 
>  * @author <a href="mailto:jbraeuchi@hotmail.com">Jakob Braeuchi</a>
>  * @version $Id: NullCriteria.java,v 1.8 2004/04/04 23:53:36 brianm Exp $
>  */
> public class NullCriteria extends ValueCriteria
> {
> 	NullCriteria(String anAttribute, String aClause, String anAlias)
> 	{
> 		super(anAttribute, null, aClause, anAlias);
> 	}
> 
> 	// PAW
> 	NullCriteria(String anAttribute, String aClause, UserAlias anAlias)
> 	{
> 		super(anAttribute, null, aClause, anAlias);
> 	}
> 
>     public String toString()
>     {
>         return getAttribute() + getClause();
>     }
> 
>     /*
>      * @see SelectionCriteria#isBound()
>      */
>     public boolean isBound()
>     {
>         return true;
>     }
> 
>     /**
>      * @see SelectionCriteria#isBindable()
>      */
>     protected boolean isBindable()
>     {
>         return false;
>     }
> 
> }
> 
> 
> ------------------------------------------------------------------------
> 
> package org.apache.ojb.broker.query;
> 
> import java.util.List;
> import java.util.Map;
> 
> /* Copyright 2002-2004 The Apache Software Foundation
>  *
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  *
>  *     http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> 
> /**
>  * abstract baseclass of all criteria classes, can't be instantiated.
>  * 
>  * This code is based on stuff from 
>  * COBRA - Java Object Persistence Layer
>  * Copyright (C) 1997, 1998    DB Harvey-George
>  * eMail: cobra@lowrent.org
> 
>  * @author DB Harvey-George
>  * @author Thomas Mahler
>  * @author <a href="mailto:jbraeuchi@hotmail.com">Jakob Braeuchi</a>
>  * @version $Id: SelectionCriteria.java,v 1.16 2004/04/24 08:25:37 brj Exp $
>  */
> public abstract class SelectionCriteria implements java.io.Serializable
> {
> 	static final long serialVersionUID = -5194901539702756536L;    protected static final String EQUAL = " = ";
>     protected static final String NOT_EQUAL = " <> ";
>     protected static final String GREATER = " > ";
>     protected static final String NOT_GREATER = " <= ";
>     protected static final String LESS = " < ";
>     protected static final String NOT_LESS = " >= ";
>     protected static final String LIKE = " LIKE ";
>     protected static final String NOT_LIKE = " NOT LIKE ";
>     protected static final String IS_NULL = " IS NULL ";
>     protected static final String NOT_IS_NULL = " IS NOT NULL ";
>     protected static final String BETWEEN = " BETWEEN ";
>     protected static final String NOT_BETWEEN = " NOT BETWEEN ";
>     protected static final String IN = " IN ";
>     protected static final String NOT_IN = " NOT IN ";
> 
> 	private Object m_attribute;
> 	private Object m_value;
> 
> 
> 	// BRJ: true if criterion is bound
> 	private boolean m_bound = false;
> 
> 	// BRJ: the criterion must be bound for the main class and for all extents
> 	private int m_numberOfExtentsToBind = 0; // BRJ: 
> 
> 	// PAW
> 	private String m_alias = null;
> 	private UserAlias m_userAlias = null;
> 	    
>     // BRJ: indicate whether attribute name should be translated into column name
>     private boolean m_translateAttribute = true;
> 
>     private Criteria m_criteria;
>     
> 	/**
> 	 * Constructor declaration
> 	 *
> 	 * @param anAttribute  column- or fieldName or a Query
> 	 * @param aValue  the value to compare with
> 	 * @param negative  criteria is negated (ie NOT LIKE instead of LIKE)
> 	 * @param alias  use alias to link anAttribute to
> 	 */
> 	SelectionCriteria(Object anAttribute, Object aValue, String alias)
> 	{
> 		if (!(anAttribute instanceof String || anAttribute instanceof Query))
> 		{
> 			throw new IllegalArgumentException("An attribute must be a String or a Query !");
> 		}    
>             
> 		m_attribute = anAttribute;
> 		m_value = aValue;
> 		this.m_bound = !isBindable();
> 		this.m_alias = alias;
> 		this.m_userAlias  = m_alias == null ? null : new UserAlias(m_alias, (String)getAttribute(), true);
> 	}
> 
> 	/**
> 	 * Constructor declaration
> 	 *
> 	 * @param anAttribute  column- or fieldName or a Query
> 	 * @param aValue  the value to compare with
> 	 * @param negative  criteria is negated (ie NOT LIKE instead of LIKE)
> 	 * @param userAlias  userAlias to link anAttribute to
> 	 * @param dummy used so that subclass constructors calling with null
> 	 * parameters have an unambiguous signature
> 	 */
> 	SelectionCriteria(Object anAttribute, Object aValue, UserAlias aUserAlias, boolean dummy)
> 	{
> 		if (!(anAttribute instanceof String || anAttribute instanceof Query))
> 		{
> 			throw new IllegalArgumentException("An attribute must be a String or a Query !");
> 		}    
>             
> 		m_attribute = anAttribute;
> 		m_value = aValue;
> 		this.m_bound = !isBindable();
> 		this.m_userAlias = aUserAlias;
> 		this.m_alias = m_userAlias == null ? null : m_userAlias.getName();
> 	}
> 
> 	/**
> 	 * Answer the SQL compare-clause for this criteria
> 	 */
> 	abstract public String getClause();
> 
> 	/**
> 	 * sets the value of the criteria to newValue. Used by the ODMG OQLQuery.bind() operation
> 	 */
> 	public void bind(Object newValue)
> 	{
> 		setValue(newValue);
> 		setBound(true);
> 	}
> 
> 	/**
> 	 * Answer the value
> 	 */
> 	public Object getValue()
> 	{
> 		return m_value;
> 	}
> 
> 	/**
> 	 * Answer the attribute
> 	 */
> 	public Object getAttribute()
> 	{
> 		return m_attribute;
> 	}
> 
> 	/**
> 	 * String representation
> 	 */
> 	public String toString()
> 	{
> 		return m_attribute + getClause() + m_value;
> 	}
> 
> 	/**
> 	 * BRJ : Used by the ODMG OQLQuery.bind() operation
> 	 * @return Returns a boolean indicator
> 	 */
> 	public boolean isBound()
> 	{
> 		return m_bound;
> 	}
> 
> 	/**
> 	 * Sets the bound.
> 	 * @param bound The bound to set
> 	 */
> 	protected void setBound(boolean bound)
> 	{
> 		this.m_bound = bound;
> 	}
> 
> 	/**
> 	 * Sets the value.
> 	 * @param value The value to set
> 	 */
> 	protected void setValue(Object value)
> 	{
> 		this.m_value = value;
> 	}
> 
> 	/**
> 	 * answer true if the selection criteria is bindable 
> 	 * BRJ: value null is bindable
> 	 */
> 	protected boolean isBindable()
> 	{
> 		return (getValue() == null);
> 	}
> 	/**
> 	 * Returns the numberOfExtentsToBind.
> 	 * @return int
> 	 */
> 	public int getNumberOfExtentsToBind()
> 	{
> 		return m_numberOfExtentsToBind;
> 	}
> 
> 	/**
> 	 * Sets the numberOfExtentsToBind.
> 	 * @param numberOfExtentsToBind The numberOfExtentsToBind to set
> 	 */
> 	public void setNumberOfExtentsToBind(int numberOfExtentsToBind)
> 	{
> 		this.m_numberOfExtentsToBind = numberOfExtentsToBind;
> 	}
> 
> 	/**
> 	 * @return String
> 	 */
> 	public String getAlias()
> 	{
> 		return m_alias;
> 	}
> 
> 	/**
> 	 * Sets the alias. By default the entire attribute path participates in the alias
> 	 * @param alias The name of the alias to set
> 	 */
> 	public void setAlias(String alias)
> 	{
> 		m_alias = alias;
> 		// PAW
> 		String attributePath = (String)getAttribute();
> 		boolean allPathsAliased = true;
> 		m_userAlias = new UserAlias(alias, attributePath, allPathsAliased);
> 		
> 	}
> 
> 	// PAW
> 	/**
> 	 * Sets the alias. 
> 	 * @param alias The alias to set
> 	 */
> 	public void setAlias(String alias, String aliasPath)
> 	{
> 		m_alias = alias;
> 		m_userAlias = new UserAlias(alias, (String)getAttribute(), aliasPath);
> 	}
> 	
> 	// PAW
> 	/**
> 	 * Sets the alias using a userAlias object. 
> 	 * @param userAlias The alias to set
> 	 */
> 	public void setAlias(UserAlias userAlias)
> 	{
> 		m_alias = userAlias.getName();
> 		m_userAlias = userAlias;
> 	}
> 
> 	public UserAlias getUserAlias()
> 	{
> 		return m_userAlias;
> 	}
> 	/**
> 	 * @return true if attribute name should be translated into column name
> 	 */
> 	public boolean isTranslateAttribute()
> 	{
> 		return m_translateAttribute;
> 	}
> 
> 	/**
> 	 * @param b
> 	 */
> 	void setTranslateAttribute(boolean b)
> 	{
> 		m_translateAttribute = b;
> 	}
> 
> 	/**
> 	 * @return
> 	 */
> 	public Criteria getCriteria()
> 	{
> 		return m_criteria;
> 	}
> 
> 	/**
> 	 * @param criteria
> 	 */
> 	void setCriteria(Criteria criteria)
> 	{
> 		m_criteria = criteria;
> 	}
> 
>     public QueryByCriteria getQuery()
>     {
>         if (getCriteria() != null)
>         {
>             return getCriteria().getQuery();
>         }
>         else
>         {
>             return null;
>         }
>     }
>     
> 	/**
> 	 * Gets the pathClasses from the parent Criteria.
> 	 * A Map containing hints about what Class to be used for what path segment
> 	 * @return Returns a Map
> 	 */
> 	// PAW
> 	public Map getPathClasses()
> 	{
> 		return getCriteria().getPathClasses();
> 	}
> 
> 	/**
> 	 * Get the a List of Class objects used as hints for a path
> 	 *
> 	 * @param aPath the path segment ie: allArticlesInGroup
> 	 * @return a List o Class objects to be used in SqlStatment
> 	 * @see #addPathClass
> 	 * @see org.apache.ojb.broker.QueryTest#testInversePathExpression()
> 	 */
> 	public List getClassesForPath(String aPath)
> 	{
> 		return getCriteria().getClassesForPath(aPath);
> 	}
>     
> 
> }
> 
> 
> ------------------------------------------------------------------------
> 
> /*
>  * Created on May 1, 2004
>  *
>  * To change the template for this generated file go to
>  * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
>  */
> package org.apache.ojb.broker.query;
> 
> import java.util.ArrayList;
> import java.util.HashMap;
> import java.util.Iterator;
> import java.util.Map;
> 
> import org.apache.ojb.broker.util.logging.Logger;
> import org.apache.ojb.broker.util.logging.LoggerFactory;
> 
> /**
>  * @author PAW
>  * This class is used to specify the path segments of a Criteria
>  * that should have associated table aliases.  Previously, the default
>  * behaviour was that all path segments participated in the alias
>  */
> public class UserAlias
> {
> 	private Map m_mapping = new HashMap();
> 	private String m_name = null;
> 	private String m_attributePath = null;
> 	private boolean m_allPathsAliased = false;
> 	private Logger m_logger = LoggerFactory.getLogger(UserAlias.class);
> 
> 	/**
> 	 * Constructor declaration
> 	 *
> 	 * @param name the name of the alias
> 	 * @param attributePath the full path of the SelectionCriteria attribute
> 	 */	
> 	public UserAlias(String name) 
> 	{
> 		m_name = name;
> 	}
> 
> 
> 	/**
> 	 * Constructor declaration
> 	 *
> 	 * @param name the name of the alias
> 	 * @param attributePath the full path of the SelectionCriteria attribute
> 	 * @param aliasPath the portion of the attributePath which should be aliased.
> 	 * This should be unambiguous.  If ambiguous portions need aliasing (e.g.
> 	 * B.C in allAs.B.C.B.C), use add() instead
> 	 */
> 	public UserAlias(String name, String attributePath, String aliasPath) 
> 		{
> 		m_name = name;
> 		m_attributePath = attributePath;
> 		if (attributePath.lastIndexOf(aliasPath) == -1)
> 		{
> 			m_logger.warn("aliasPath should be a substring of attributePath");
> 		}
> 		initMapping(attributePath, aliasPath);
> 	}
> 
> 	/**
> 	 * Constructor declaration
> 	 *
> 	 * @param name the name of the alias
> 	 * @param attributePath the full path of the SelectionCriteria attribute
> 	 * @param allPathsAliased indicates that all path portions of attributePath
> 	 * should be aliased (previously was the default)
> 	 */
> 	public UserAlias(String name, String attributePath, boolean allPathsAliased) 
> 	{
> 		m_name = name;
> 		m_attributePath = attributePath;
> 		m_allPathsAliased = allPathsAliased;
> 	}
> 
> 	/**
> 	 * generates the mapping from the aliasPath
> 	 * @param aliasPath the portion of attributePath which should be aliased
> 	 *
> 	 */
> 	private void initMapping(String attributePath, String aliasPath)
> 	{	
> 		Iterator aliasSegmentItr = pathToSegments(aliasPath).iterator();
> 		String currPath = "";
> 		String separator = "";
> 		while (aliasSegmentItr.hasNext())
> 		{
> 			currPath = currPath + separator + (String)aliasSegmentItr.next();
> 			int beginIndex = attributePath.indexOf(currPath);
> 			if (beginIndex == -1)
> 			{
> 				break;
> 			}
> 			int endIndex = beginIndex + currPath.length();
> 			m_mapping.put(attributePath.substring(0, endIndex), m_name);
> 			separator = ".";
> 		}
> 	}
> 
> 	private ArrayList pathToSegments(String path)
> 	{
> 		ArrayList segments = new ArrayList();
> 		int sp = path.indexOf('.');
> 		while (sp != -1)
> 		{
> 			segments.add(path.substring(0, sp));
> 			path = path.substring(sp+1);
> 			sp = path.indexOf('.');
> 		}
> 		segments.add(path);
> 		return segments;
> 	}
> 	
> 	/**
> 	 * Returns the name of this alias
> 	 */
> 	public String getName() 
> 	{
> 		return m_name;
> 	}
> 
> 	/**
> 	 * Returns the name of this alias if path has been added
> 	 * to the aliased portions of attributePath
> 	 *
> 	 * @param path the path to test for inclusion in the alias
> 	 */
> 	public String getAlias(String path) 
> 	{
> 		if (m_allPathsAliased && m_attributePath.lastIndexOf(path) != -1)
> 		{
> 			return m_name;
> 		}
> 		Object retObj = m_mapping.get(path);
> 		if (retObj != null)
> 		{
> 			return (String)retObj;	
> 		}
> 		return null;
> 	}
> 
> 	/**
> 	 * Adds a path to the aliased paths
> 	 *
> 	 * @param path the path to add to the aliased paths
> 	 */
> 	public void add(String path) 
> 	{
> 		m_mapping.put(path, m_name);
> 	}
> }
> 
> 
> ------------------------------------------------------------------------
> 
> package org.apache.ojb.broker.query;
> 
> /* Copyright 2002-2004 The Apache Software Foundation
>  *
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  *
>  *     http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> 
> /**
>  * Models a Criteria comparing an attribute to a value
>  * <br>ie: name = 'Mark' , name like 'M%'
>  * 
>  * @author <a href="mailto:jbraeuchi@gmx.ch">Jakob Braeuchi</a>
>  * @version $Id: ValueCriteria.java,v 1.7 2004/04/04 23:53:36 brianm Exp $
>  */ 
> public class ValueCriteria extends SelectionCriteria
> {
> 	static ValueCriteria buildEqualToCriteria(Object anAttribute, Object aValue, String anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, EQUAL, anAlias);
> 	}
> 	// PAW
> 	static ValueCriteria buildEqualToCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, EQUAL, anAlias);
> 	}
> 
> 	static ValueCriteria buildNotEqualToCriteria(Object anAttribute, Object aValue, String anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, NOT_EQUAL, anAlias);
> 	}
> 	static ValueCriteria buildNotEqualToCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, NOT_EQUAL, anAlias);
> 	}
> 
> 	static ValueCriteria buildGreaterCriteria(Object anAttribute, Object aValue, String anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue,GREATER, anAlias);
> 	}
> 	static ValueCriteria buildGreaterCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue,GREATER, anAlias);
> 	}
> 
> 	static ValueCriteria buildNotGreaterCriteria(Object anAttribute, Object aValue, String anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, NOT_GREATER, anAlias);
> 	}
> 	static ValueCriteria buildNotGreaterCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, NOT_GREATER, anAlias);
> 	}
> 
> 	static ValueCriteria buildLessCriteria(Object anAttribute, Object aValue, String anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, LESS, anAlias);
> 	}
> 	static ValueCriteria buildLessCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, LESS, anAlias);
> 	}
> 
> 	static ValueCriteria buildNotLessCriteria(Object anAttribute, Object aValue, String anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, NOT_LESS, anAlias);
> 	}
> 	static ValueCriteria buildNotLessCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, NOT_LESS, anAlias);
> 	}
> 
> 	static ValueCriteria buildLikeCriteria(Object anAttribute, Object aValue, String anAlias)
> 	{
> 		return new LikeCriteria(anAttribute, aValue, LIKE, anAlias);
> 	}
> 	static ValueCriteria buildLikeCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
> 	{
> 		return new LikeCriteria(anAttribute, aValue, LIKE, anAlias);
> 	}
> 
> 	static ValueCriteria buildNotLikeCriteria(Object anAttribute, Object aValue, String anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, NOT_LIKE, anAlias);
> 	}
> 	static ValueCriteria buildNotLikeCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
> 	{
> 		return new ValueCriteria(anAttribute, aValue, NOT_LIKE, anAlias);
> 	}
> 
> 	static InCriteria buildInCriteria(Object anAttribute, Object aValue, String anAlias)
> 	{
> 		return new InCriteria(anAttribute, aValue, IN, anAlias);
> 	}
> 	static InCriteria buildInCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
> 	{
> 		return new InCriteria(anAttribute, aValue, IN, anAlias);
> 	}
> 
> 	static InCriteria buildNotInCriteria(Object anAttribute, Object aValue, String anAlias)
> 	{
> 		return new InCriteria(anAttribute, aValue, NOT_IN, anAlias);
> 	}
> 	static InCriteria buildNotInCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
> 	{
> 		return new InCriteria(anAttribute, aValue, NOT_IN, anAlias);
> 	}
> 
> 	static NullCriteria buildNullCriteria(String anAttribute, String anAlias)
> 	{
> 		return new NullCriteria(anAttribute, IS_NULL, anAlias);
> 	}
> 	static NullCriteria buildNullCriteria(String anAttribute, UserAlias anAlias)
> 	{
> 		return new NullCriteria(anAttribute, IS_NULL, anAlias);
> 	}
> 
> 	static NullCriteria buildNotNullCriteria(String anAttribute, String anAlias)
> 	{
> 		return new NullCriteria(anAttribute, NOT_IS_NULL, anAlias);
> 	}
> 	static NullCriteria buildNotNullCriteria(String anAttribute, UserAlias anAlias)
> 	{
> 		return new NullCriteria(anAttribute, NOT_IS_NULL, anAlias);
> 	}
>    
> 	static BetweenCriteria buildBeweenCriteria(Object anAttribute, Object aValue1, Object aValue2, String anAlias)
> 	{
> 		return new BetweenCriteria(anAttribute, aValue1, aValue2, BETWEEN, anAlias);
> 	}
> 	static BetweenCriteria buildBeweenCriteria(Object anAttribute, Object aValue1, Object aValue2, UserAlias anAlias)
> 	{
> 		return new BetweenCriteria(anAttribute, aValue1, aValue2, BETWEEN, anAlias);
> 	}
> 
> 	static BetweenCriteria buildNotBeweenCriteria(Object anAttribute, Object aValue1, Object aValue2, String anAlias)
> 	{
> 		return new BetweenCriteria(anAttribute, aValue1, aValue2, NOT_BETWEEN, anAlias);
> 	}
> 	static BetweenCriteria buildNotBeweenCriteria(Object anAttribute, Object aValue1, Object aValue2, UserAlias anAlias)
> 	{
> 		return new BetweenCriteria(anAttribute, aValue1, aValue2, NOT_BETWEEN, anAlias);
> 	}
>     
>     private String m_clause;
> 
> 	/**
> 	 * Constructor declaration
> 	 *
> 	 * @param anAttribute  column- or fieldName
> 	 * @param aValue  the value to compare with
> 	 * @param aClause the SQL compare clause (ie LIKE, = , IS NULL)
> 	 * @param anAlias use alias to link anAttribute to
> 	 */
> 	ValueCriteria(Object anAttribute, Object aValue, String aClause, String anAlias)
> 	{
> 		super(anAttribute, aValue, anAlias);
> 		m_clause = aClause;
> 	}
>     
> 	/**
> 	 * Constructor declaration
> 	 *
> 	 * @param anAttribute  column- or fieldName
> 	 * @param aValue  the value to compare with
> 	 * @param aClause the SQL compare clause (ie LIKE, = , IS NULL)
> 	 * @param aUserAliass userAlias to link anAttribute to
> 	 */
> 	// PAW
> 	ValueCriteria(Object anAttribute, Object aValue, String aClause, UserAlias aUserAlias)
> 	{
> 		super(anAttribute, aValue, aUserAlias, false);
> 		m_clause = aClause;
> 	}
>     
> 
>     /* (non-Javadoc)
>      * @see org.apache.ojb.broker.query.SelectionCriteria#getClause()
>      */
>     public String getClause()
>     {
>         return m_clause;
>     }
> 
> }
> 
> 
> ------------------------------------------------------------------------
> 
> package org.apache.ojb.broker.query;
> 
> 
> /* Copyright 2002-2004 The Apache Software Foundation
>  *
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  *
>  *     http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> 
> /**
>  * SelectionCriteria for 'between x and y'
>  *
>  * @author <a href="mailto:jbraeuchi@hotmail.com">Jakob Braeuchi</a>
>  * @version $Id: BetweenCriteria.java,v 1.9 2004/04/24 08:25:37 brj Exp $
>  */
> public class BetweenCriteria extends ValueCriteria
> {
>     private Object value2;
> 	
> 	BetweenCriteria(Object anAttribute, Object aValue1, Object aValue2, String aClause, String anAlias)
> 	{
> 		super(anAttribute, aValue1, aClause, anAlias);
> 		setValue2(aValue2);
> 	}
> 
> 	// PAW
> 	BetweenCriteria(Object anAttribute, Object aValue1, Object aValue2, String aClause, UserAlias aUserAlias)
> 	{
> 		super(anAttribute, aValue1, aClause, aUserAlias);
> 		setValue2(aValue2);
> 	}
> 
>     /**
>      * sets the value of the criteria to newValue. 
>      * Used by the ODMG OQLQuery.bind() operation
>      * BRJ: bind get's called twice so we need to know which value to set
>      */
>     public void bind(Object newValue)
>     {
>     	if (getValue() == null)
>     	{
>     		setValue(newValue);
>     	}	
>     	else
>     	{
>     		setValue2(newValue);
>     		setBound(true); 		
>     	}
>     }
> 
> 
> 	/**
> 	 * Gets the value2.
> 	 * @return Returns a Object
> 	 */
> 	public Object getValue2()
> 	{
> 		return value2;
> 	}
> 
> 	/**
> 	 * Sets the value2.
> 	 * @param value2 The value2 to set
> 	 */
> 	protected void setValue2(Object value2)
> 	{
> 		this.value2 = value2;
> 	}
> 
> 	/**
> 	 * @see org.apache.ojb.broker.query.SelectionCriteria#isBindable()
> 	 */
> 	protected boolean isBindable()
> 	{
> 		return (getValue() == null && getValue2() == null);
> 	}
> 
> 	// PAW
> 	/**
> 	 * String representation
> 	 */
> 	public String toString()
> 	{
> 		return super.toString() + " AND " + value2;
> 	}
> }
> 
> 
> 
> ------------------------------------------------------------------------
> 
> package org.apache.ojb.broker.query;
> 
> /* Copyright 2002-2004 The Apache Software Foundation
>  *
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  *
>  *     http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> 
> import java.util.ArrayList;
> import java.util.Collection;
> import java.util.Enumeration;
> import java.util.HashMap;
> import java.util.Iterator;
> import java.util.List;
> import java.util.Map;
> import java.util.Vector;
> 
> import org.apache.ojb.broker.PersistenceBrokerFactory;
> import org.apache.ojb.broker.metadata.FieldHelper;
> import org.apache.ojb.broker.core.PersistenceBrokerConfiguration;
> import org.apache.ojb.broker.util.configuration.ConfigurationException;
> 
> /**
>  * Persistent Criteria can be used to retrieve sets of objects based on their attributes
>  * Normally each attribute is ANDed together, an OR can be performed by creating a new
>  * PersistentCriteria and adding it.
>  * <P>
>  * Criteria are used, rather than a simple string, because they can be precompiled for
>  * efficiency.
>  *
>  * This code is based on stuff from
>  * COBRA - Java Object Persistence Layer
>  * Copyright (C) 1997, 1998    DB Harvey-George
>  * eMail: cobra@lowrent.org
>  *
>  * @author <a href="mailto:jbraeuchi@gmx.ch">Jakob Braeuchi</a>
>  * @version $Id: Criteria.java,v 1.44 2004/04/24 08:25:37 brj Exp $
>  */
> public class Criteria implements java.io.Serializable
> {
>     static final long serialVersionUID = 7384550404778187808L;
> 
>     /** criteria is OR-ed with it's parent */
>     public static final int OR = 0;
>     /** criteria is AND-ed with it's parent */
>     public static final int AND = 1;
>     /** criteria has no parent */
>     public static final int NONE = 9;
> 
>     /** prefix to identify attributes referencing enclosing query */
>     public static final String PARENT_QUERY_PREFIX = "parentQuery.";
> 
>     private Vector m_criteria;
>     private int m_type;
>     private boolean m_embraced;
>     private boolean m_negative = false;
> 
>     // holding CriteriaFields for orderBy and groupBy
>     private List orderby = null;
>     private List groupby = null;
>     private List prefetchedRelationships = null;
> 
> 	// an optional alias to be used for this criteria
> 	private String m_alias = null;
> 
> 	// PAW
> 	// an aliasPath to be used for this criteria
> 	private String m_aliasPath = null;
> 
> 	// holds the path segment(s) to which the alias applies
> 	private UserAlias m_userAlias = null;
> 	
> 	/** the max. number of parameters in a IN-statement */
>     protected static final int IN_LIMIT = getSqlInLimit();
> 
>     private QueryByCriteria m_query;
>     private Criteria m_parentCriteria;
> 
>     // PAW
> 	// hint classes for paths of this criteria
> 	private Map m_pathClasses;
> 
>     /**
>      * Constructor declaration
>      */
>     public Criteria()
>     {
>         m_criteria = new Vector();
>         groupby = new ArrayList();
>         orderby = new ArrayList();
>         prefetchedRelationships = new ArrayList();
>         m_type = NONE;
>         m_embraced = false;
>         // PAW
> 		m_pathClasses = new HashMap();
>     }
> 
>     /**
>      * Constructor with a SelectionCriteria
>      * @param aSelectionCriteria SelectionCriteria
>      */
>     public Criteria(SelectionCriteria aSelectionCriteria)
>     {
>         this();
>         addSelectionCriteria(aSelectionCriteria);
>     }
> 
>     /**
>      * make a copy of the criteria
>      * @param includeGroupBy if true
>      * @param includeOrderBy if ture
>      * @param includePrefetchedRelationships if true
>      * @return a copy of the criteria
>      */
>     public Criteria copy(boolean includeGroupBy, boolean includeOrderBy, boolean includePrefetchedRelationships)
>     {
>         Criteria copy = new Criteria();
> 
>         copy.m_criteria = this.m_criteria;
>         copy.m_negative = this.m_negative;
> 
>         if (includeGroupBy)
>         {
>             copy.groupby = this.groupby;
>         }
>         if (includeOrderBy)
>         {
>             copy.orderby = this.orderby;
>         }
>         if (includePrefetchedRelationships)
>         {
>             copy.prefetchedRelationships = this.prefetchedRelationships;
>         }
> 
>         return copy;
>     }
> 
>     protected void addSelectionCriteria(SelectionCriteria selectionCrit)
>     {
>         selectionCrit.setCriteria(this);
>         m_criteria.addElement(selectionCrit);
>     }
> 
>     protected void addCriteria(Criteria crit)
>     {
>         crit.setParentCriteria(this);
>         m_criteria.addElement(crit);
>     }
> 
>     protected void addCriteria(Vector criteria)
>     {
>         Object crit;
> 
>         for (int i = 0; i < criteria.size(); i++)
>         {
>             crit = criteria.elementAt(i);
>             if (crit instanceof SelectionCriteria)
>             {
>                 addSelectionCriteria((SelectionCriteria) crit);
>             }
>             else if (crit instanceof Criteria)
>             {
>                 addCriteria((Criteria) crit);
>             }
>         }
>     }
> 
>     /**
>      * Answer a List of InCriteria based on values, each InCriteria
>      * contains only inLimit values
>      * @param attribute
>      * @param values
>      * @param negative
>      * @param inLimit the maximum number of values for IN (-1 for no limit)
>      * @return
>      */
>     protected List splitInCriteria(Object attribute, Collection values, boolean negative, int inLimit)
>     {
>         List result = new ArrayList();
>         Collection inCollection = new ArrayList();
> 
>         if (values == null || values.isEmpty())
>         {
>             // OQL creates empty Criteria for late binding
>             result.add(buildInCriteria(attribute, negative, values));
>         }
>         else
>         {
>             Iterator iter = values.iterator();
> 
>             while (iter.hasNext())
>             {
>                 inCollection.add(iter.next());
>                 if (inCollection.size() == inLimit || !iter.hasNext())
>                 {
>                     result.add(buildInCriteria(attribute, negative, inCollection));
>                     inCollection = new ArrayList();
>                 }
>             }
>         }
>         return result;
>     }
> 
>     private InCriteria buildInCriteria(Object attribute, boolean negative, Collection values)
>     {
>         if (negative)
>         {
>         	// PAW
> 			// return ValueCriteria.buildNotInCriteria(attribute, values, getAlias());
> 			return ValueCriteria.buildNotInCriteria(attribute, values, getUserAlias(attribute));
>         }
>         else
>         {
> 			// PAW
> 			// return ValueCriteria.buildInCriteria(attribute, values, getAlias());
> 			return ValueCriteria.buildInCriteria(attribute, values, getUserAlias(attribute));
>         }
>     }
> 
>     /**
>      * Get an Enumeration with all sub criteria
>      * @return Enumeration
>      */
>     public Enumeration getElements()
>     {
>         return getCriteria().elements();
>     }
> 
>     /**
>      * Get a Vector with all sub criteria
>      * @return Vector
>      */
>     protected Vector getCriteria()
>     {
>         return m_criteria;
>     }
> 
>     /**
>      * Answer the type
>      * @return int
>      */
>     public int getType()
>     {
>         return m_type;
>     }
> 
>     /**
>      * Set the type
>      * @param type OR, AND, NONE
>      */
>     public void setType(int type)
>     {
>         m_type = type;
>     }
> 
>     /**
>      * ANDed criteria are embraced
>      * @return true if embraced,
>      */
>     public boolean isEmbraced()
>     {
>         return m_embraced;
>     }
> 
>     /**
>      * Set embraced
>      * @param embraced true if criteria is to be surrounded by braces
>      */
>     public void setEmbraced(boolean embraced)
>     {
>         m_embraced = embraced;
>     }
> 
>     /**
>      * Adds and equals (=) criteria,
>      * customer_id = 10034
>      *
>      * @param  attribute   The field name to be used
>      * @param  value       An object representing the value of the field
>      */
>     public void addEqualTo(String attribute, Object value)
>     {
>     	// PAW
> //		addSelectionCriteria(ValueCriteria.buildEqualToCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildEqualToCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds and equals (=) criteria,
>      * CUST_ID = 10034
>      * attribute will NOT be translated into column name
>      *
>      * @param  column   The column name to be used without translation
>      * @param  value    An object representing the value of the column
>      */
>     public void addColumnEqualTo(String column, Object value)
>     {
>     	// PAW
> //		SelectionCriteria c = ValueCriteria.buildEqualToCriteria(column, value, getAlias());
> 		SelectionCriteria c = ValueCriteria.buildEqualToCriteria(column, value, getUserAlias(column));
>         c.setTranslateAttribute(false);
>         addSelectionCriteria(c);
>     }
> 
>     /**
>      * Adds and equals (=) criteria for field comparison.
>      * The field name will be translated into the appropriate columnName by SqlStatement.
>      * The attribute will NOT be translated into column name
>      *
>      * @param  column       The column name to be used without translation
>      * @param  fieldName    An object representing the value of the field
>      */
>     public void addColumnEqualToField(String column, Object fieldName)
>     {
>     	// PAW
> 		//SelectionCriteria c = FieldCriteria.buildEqualToCriteria(column, fieldName, getAlias());
> 		SelectionCriteria c = FieldCriteria.buildEqualToCriteria(column, fieldName, getUserAlias(column));
>         c.setTranslateAttribute(false);
>         addSelectionCriteria(c);
>     }
> 
>     /**
>      * Adds and equals (=) criteria for field comparison.
>      * The field name will be translated into the appropriate columnName by SqlStatement.
>      * <br>
>      * name = boss.name
>      *
>      * @param  attribute   The field name to be used
>      * @param  fieldName   The field name to compare with
>      */
>     public void addEqualToField(String attribute, String fieldName)
>     {
> 		// PAW
> 		// FieldCriteria c = FieldCriteria.buildEqualToCriteria(attribute, fieldName, getAlias());
> 		FieldCriteria c = FieldCriteria.buildEqualToCriteria(attribute, fieldName, getUserAlias(attribute));
>         addSelectionCriteria(c);
>     }
> 
>     /**
>      * Adds and equals (=) criteria for field comparison.
>      * The field name will be translated into the appropriate columnName by SqlStatement.
>      * <br>
>      * name <> boss.name
>      *
>      * @param  attribute   The field name to be used
>      * @param  fieldName   The field name to compare with
>      */
>     public void addNotEqualToField(String attribute, String fieldName)
>     {
>         // PAW
> 		// SelectionCriteria c = FieldCriteria.buildNotEqualToCriteria(attribute, fieldName, getAlias());
> 		SelectionCriteria c = FieldCriteria.buildNotEqualToCriteria(attribute, fieldName, getUserAlias(attribute));
>         addSelectionCriteria(c);
>     }
> 
>     /**
>      * Adds and equals (<>) criteria for column comparison.
>      * The column Name will NOT be translated.
>      * <br>
>      * name <> T_BOSS.LASTNMAE
>      *
>      * @param  attribute   The field name to be used
>      * @param  colName     The name of the column to compare with
>      */
>     public void addNotEqualToColumn(String attribute, String colName)
>     {
>         // PAW
> 		// FieldCriteria c = FieldCriteria.buildNotEqualToCriteria(attribute, colName, getAlias());
> 		FieldCriteria c = FieldCriteria.buildNotEqualToCriteria(attribute, colName, getUserAlias(attribute));
>         c.setTranslateField(false);
>         addSelectionCriteria(c);
>     }
> 
>     /**
>      * Adds and equals (=) criteria for column comparison.
>      * The column Name will NOT be translated.
>      * <br>
>      * name = T_BOSS.LASTNMAE
>      *
>      * @param  attribute   The field name to be used
>      * @param  colName     The name of the column to compare with
>      */
>     public void addEqualToColumn(String attribute, String colName)
>     {
> 		// FieldCriteria c = FieldCriteria.buildEqualToCriteria(attribute, colName, getAlias());
> 		FieldCriteria c = FieldCriteria.buildEqualToCriteria(attribute, colName, getUserAlias(attribute));
>         c.setTranslateField(false);
>         addSelectionCriteria(c);
>     }
> 
>     /**
>      * Adds GreaterOrEqual Than (>=) criteria,
>      * customer_id >= 10034
>      *
>      * @param  attribute   The field name to be used
>      * @param  value       An object representing the value of the field
>      */
>     public void addGreaterOrEqualThan(Object attribute, Object value)
>     {
> 		// PAW
> 		// addSelectionCriteria(ValueCriteria.buildNotLessCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildNotLessCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds GreaterOrEqual Than (>=) criteria,
>      * customer_id >= person_id
>      *
>      * @param  attribute   The field name to be used
>      * @param  value       The field name to compare with
>      */
>     public void addGreaterOrEqualThanField(String attribute, Object value)
>     {
> 		// PAW
> 		// addSelectionCriteria(FieldCriteria.buildNotLessCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(FieldCriteria.buildNotLessCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds LessOrEqual Than (<=) criteria,
>      * customer_id <= 10034
>      *
>      * @param  attribute   The field name to be used
>      * @param  value       An object representing the value of the field
>      */
>     public void addLessOrEqualThan(Object attribute, Object value)
>     {
> 		// PAW
> 		// addSelectionCriteria(ValueCriteria.buildNotGreaterCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildNotGreaterCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds LessOrEqual Than (<=) criteria,
>      * customer_id <= person_id
>      *
>      * @param  attribute   The field name to be used
>      * @param  value       The field name to compare with
>      */
>     public void addLessOrEqualThanField(String attribute, Object value)
>     {
> 		// PAW
> 		// addSelectionCriteria(FieldCriteria.buildNotGreaterCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(FieldCriteria.buildNotGreaterCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds Like (LIKE) criteria,
>      * customer_name LIKE "m%ller"
>      *
>      * @see LikeCriteria
>      * @param  attribute   The field name to be used
>      * @param  value       An object representing the value of the field
>      */
>     public void addLike(Object attribute, Object value)
>     {
> 		// PAW
> 		// addSelectionCriteria(ValueCriteria.buildLikeCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildLikeCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds Like (NOT LIKE) criteria,
>      * customer_id NOT LIKE 10034
>      *
>      * @see LikeCriteria
>      * @param  attribute   The field name to be used
>      * @param  value       An object representing the value of the field
>      */
>     public void addNotLike(String attribute, Object value)
>     {
> 		// PAW 
> 		// addSelectionCriteria(ValueCriteria.buildNotLikeCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildNotLikeCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds NotEqualTo (<>) criteria,
>      * customer_id <> 10034
>      *
>      * @param  attribute   The field name to be used
>      * @param  value       An object representing the value of the field
>      */
>     public void addNotEqualTo(Object attribute, Object value)
>     {
> 		// PAW
> 		// addSelectionCriteria(ValueCriteria.buildNotEqualToCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildNotEqualToCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds Greater Than (>) criteria,
>      * customer_id > 10034
>      *
>      * @param  attribute   The field name to be used
>      * @param  value       An object representing the value of the field
>      */
>     public void addGreaterThan(Object attribute, Object value)
>     {
> 		// PAW
> 		// addSelectionCriteria(ValueCriteria.buildGreaterCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildGreaterCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds Greater Than (>) criteria,
>      * customer_id > person_id
>      *
>      * @param  attribute   The field name to be used
>      * @param  value       The field to compare with
>      */
>     public void addGreaterThanField(String attribute, Object value)
>     {
> 		// PAW
> 		// addSelectionCriteria(FieldCriteria.buildGreaterCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(FieldCriteria.buildGreaterCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds Less Than (<) criteria,
>      * customer_id < 10034
>      *
>      * @param  attribute   The field name to be used
>      * @param  value       An object representing the value of the field
>      */
>     public void addLessThan(Object attribute, Object value)
>     {
> 		// PAW
> 		// addSelectionCriteria(ValueCriteria.buildLessCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildLessCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds Less Than (<) criteria,
>      * customer_id < person_id
>      *
>      * @param  attribute   The field name to be used
>      * @param  value       The field to compare with
>      */
>     public void addLessThanField(String attribute, Object value)
>     {
> 		// PAW
> 		// addSelectionCriteria(FieldCriteria.buildLessCriteria(attribute, value, getAlias()));
> 		addSelectionCriteria(FieldCriteria.buildLessCriteria(attribute, value, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds a field for orderBy, order is ASCENDING
>      * @param  fieldName The field name to be used
>      * @deprecated use #addOrderByAscending(String fieldName)
>      */
>     public void addOrderBy(String fieldName)
>     {
>         addOrderBy(fieldName, true);
>     }
> 
>     /**
>      * Adds a field for orderBy
>      * @param  fieldName the field name to be used
>      * @param  sortAscending true for ASCENDING, false for DESCENDING
>      * @deprecated use QueryByCriteria#addOrderBy
>      */
>     public void addOrderBy(String fieldName, boolean sortAscending)
>     {
>         if (fieldName != null)
>         {
>             _getOrderby().add(new FieldHelper(fieldName, sortAscending));
>         }
>     }
> 
>     /**
>      * Adds a field for orderBy
>      * @param aField the Field
>      * @deprecated use QueryByCriteria#addOrderBy
>      */
>     public void addOrderBy(FieldHelper aField)
>     {
>         if (aField != null)
>         {
>             _getOrderby().add(aField);
>         }
>     }
> 
>     /**
>      * Adds a field for orderBy ASCENDING
>      * @param  fieldName The field name to be used
>      * @deprecated use QueryByCriteria#addOrderByAscending
>      */
>     public void addOrderByAscending(String fieldName)
>     {
>         addOrderBy(fieldName, true);
>     }
> 
>     /**
>      * Adds a field for orderBy DESCENDING
>      * @param  fieldName The field name to be used
>      * @deprecated use QueryByCriteria#addOrderByDescending
>      */
>     public void addOrderByDescending(String fieldName)
>     {
>         addOrderBy(fieldName, false);
>     }
> 
>     /**
>      * Answer the orderBy of all Criteria and Sub Criteria
>      * the elements are of class Criteria.FieldHelper
>      * @return List
>      */
>     List getOrderby()
>     {
>         List result = _getOrderby();
>         Iterator iter = getCriteria().iterator();
>         Object crit;
> 
>         while (iter.hasNext())
>         {
>             crit = iter.next();
>             if (crit instanceof Criteria)
>             {
>                 result.addAll(((Criteria) crit).getOrderby());
>             }
>         }
> 
>         return result;
>     }
> 
>     /**
>      * Answer the Vector with all orderBy,
>      * the elements are of class Criteria.FieldHelper
>      * @return List
>      */
>     protected List _getOrderby()
>     {
>         return orderby;
>     }
> 
>     /**
>      * ORs two sets of criteria together:
>      * <pre>
>      * active = true AND balance < 0 OR active = true AND overdraft = 0
>      * </pre>
>      * @param pc criteria
>      */
>     public void addOrCriteria(Criteria pc)
>     {
>         if (!m_criteria.isEmpty())
>         {
>             pc.setEmbraced(true);
>             pc.setType(OR);
>             addCriteria(pc);
>         }
>         else
>         {
>             setEmbraced(false);
>             pc.setType(OR);
>             addCriteria(pc);
>         }
>     }
> 
>     /**
>      * Adds is Null criteria,
>      * customer_id is Null
>      *
>      * @param  attribute   The field name to be used
>      */
>     public void addIsNull(String attribute)
>     {
> 		// PAW
> 		//addSelectionCriteria(ValueCriteria.buildNullCriteria(attribute, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildNullCriteria(attribute, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds is Null criteria,
>      * customer_id is Null
>      * The attribute will NOT be translated into column name
>      *
>      * @param  column   The column name to be used without translation
>      */
>     public void addColumnIsNull(String column)
>     {
> 		// PAW
> 		//SelectionCriteria c = ValueCriteria.buildNullCriteria(column, getAlias());
> 		SelectionCriteria c = ValueCriteria.buildNullCriteria(column, getUserAlias(column));
>         c.setTranslateAttribute(false);
>         addSelectionCriteria(c);
>     }
> 
>     /**
>      * Adds not Null criteria,
>      * customer_id is not Null
>      *
>      * @param  attribute   The field name to be used
>      */
>     public void addNotNull(String attribute)
>     {
> 		// PAW
> 		//addSelectionCriteria(ValueCriteria.buildNotNullCriteria(attribute, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildNotNullCriteria(attribute, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds not Null criteria,
>      * customer_id is not Null
>      * The attribute will NOT be translated into column name
>      *
>      * @param  column   The column name to be used without translation
>      */
>     public void addColumnNotNull(String column)
>     {
> 		// PAW
> 		// SelectionCriteria c = ValueCriteria.buildNotNullCriteria(column, getAlias());
> 		SelectionCriteria c = ValueCriteria.buildNotNullCriteria(column, getUserAlias(column));
>         c.setTranslateAttribute(false);
>         addSelectionCriteria(c);
>     }
> 
>     /**
>      * Adds BETWEEN criteria,
>      * customer_id between 1 and 10
>      *
>      * @param  attribute   The field name to be used
>      * @param  value1   The lower boundary
>      * @param  value2   The upper boundary
>      */
>     public void addBetween(Object attribute, Object value1, Object value2)
>     {
> 		// PAW
> 		// addSelectionCriteria(ValueCriteria.buildBeweenCriteria(attribute, value1, value2, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildBeweenCriteria(attribute, value1, value2, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds NOT BETWEEN criteria,
>      * customer_id not between 1 and 10
>      *
>      * @param  attribute   The field name to be used
>      * @param  value1   The lower boundary
>      * @param  value2   The upper boundary
>      */
>     public void addNotBetween(Object attribute, Object value1, Object value2)
>     {
>         // PAW
> 		// addSelectionCriteria(ValueCriteria.buildNotBeweenCriteria(attribute, value1, value2, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildNotBeweenCriteria(attribute, value1, value2, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds IN criteria,
>      * customer_id in(1,10,33,44)
>      * large values are split into multiple InCriteria
>      * IN (1,10) OR IN(33, 44)
>      *
>      * @param  attribute   The field name to be used
>      * @param  values   The value Collection
>      */
>     public void addIn(String attribute, Collection values)
>     {
>         List list = splitInCriteria(attribute, values, false, IN_LIMIT);
>         int index = 0;
>         InCriteria inCrit;
>         Criteria allInCritaria;
> 
>         inCrit = (InCriteria) list.get(index);
>         allInCritaria = new Criteria(inCrit);
> 
>         for (index = 1; index < list.size(); index++)
>         {
>             inCrit = (InCriteria) list.get(index);
>             allInCritaria.addOrCriteria(new Criteria(inCrit));
>         }
> 
>         addAndCriteria(allInCritaria);
>     }
> 
>     /**
>      * Adds IN criteria,
>      * customer_id in(1,10,33,44)
>      * large values are split into multiple InCriteria
>      * IN (1,10) OR IN(33, 44) </br>
>      * The attribute will NOT be translated into column name
>      *
>      * @param  column   The column name to be used without translation
>      * @param  values   The value Collection
>      */
>     public void addColumnIn(String column, Collection values)
>     {
>         List list = splitInCriteria(column, values, false, IN_LIMIT);
>         int index = 0;
>         InCriteria inCrit;
>         Criteria allInCritaria;
> 
>         inCrit = (InCriteria) list.get(index);
>         inCrit.setTranslateAttribute(false);
>         allInCritaria = new Criteria(inCrit);
> 
>         for (index = 1; index < list.size(); index++)
>         {
>             inCrit = (InCriteria) list.get(index);
>             inCrit.setTranslateAttribute(false);
>             allInCritaria.addOrCriteria(new Criteria(inCrit));
>         }
> 
>         addAndCriteria(allInCritaria);
>     }
>     
>     /**
>      * Adds NOT IN criteria,
>      * customer_id not in(1,10,33,44)
>      * large values are split into multiple InCriteria
>      * NOT IN (1,10) AND NOT IN(33, 44)
>      *
>      * @param  attribute   The field name to be used
>      * @param  values   The value Collection
>      */
>     public void addNotIn(String attribute, Collection values)
>     {
>         List list = splitInCriteria(attribute, values, true, IN_LIMIT);
>         int index = 0;
>         InCriteria inCrit;
> 
>         for (index = 0; index < list.size(); index++)
>         {
>             inCrit = (InCriteria) list.get(index);
>             addSelectionCriteria(inCrit);
>         }
>     }
> 
>     /**
>      * IN Criteria with SubQuery
>      * @param attribute The field name to be used
>      * @param subQuery  The subQuery
>      */
>     public void addIn(Object attribute, Query subQuery)
>     {
>         // PAW
> 		// addSelectionCriteria(ValueCriteria.buildInCriteria(attribute, subQuery, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildInCriteria(attribute, subQuery, getUserAlias(attribute)));
>     }
> 
>     /**
>      * NOT IN Criteria with SubQuery
>      * @param attribute The field name to be used
>      * @param subQuery  The subQuery
>      */
>     public void addNotIn(String attribute, Query subQuery)
>     {
> 		// PAW
> 		// addSelectionCriteria(ValueCriteria.buildNotInCriteria(attribute, subQuery, getAlias()));
> 		addSelectionCriteria(ValueCriteria.buildNotInCriteria(attribute, subQuery, getUserAlias(attribute)));
>     }
> 
>     /**
>      * Adds freeform SQL criteria,
>      * REVERSE(name) like 're%'
>      *
>      * @param  anSqlStatment   The free form SQL-Statement
>      */
>     public void addSql(String anSqlStatment)
>     {
>         addSelectionCriteria(new SqlCriteria(anSqlStatment));
>     }
> 
>     /**
>      * ANDs two sets of criteria together:
>      *
>      * @param  pc criteria
>      */
>     public void addAndCriteria(Criteria pc)
>     {
>         // by combining a second criteria by 'AND' the existing criteria needs to be enclosed
>         // in parenthesis
>         if (!m_criteria.isEmpty())
>         {
>             this.setEmbraced(true);
>             pc.setEmbraced(true);
>             pc.setType(AND);
>             addCriteria(pc);
>         }
>         else
>         {
>             setEmbraced(false);
>             pc.setType(AND);
>             addCriteria(pc);
>         }
>     }
> 
>     /**
>      * Adds an exists(sub query)
>      *
>      * @param subQuery sub-query
>      */
>     public void addExists(Query subQuery)
>     {
>         addSelectionCriteria(new ExistsCriteria(subQuery, false));
>     }
> 
>     /**
>      * Adds a not exists(sub query)
>      *
>      * @param subQuery sub-query
>      */
>     public void addNotExists(Query subQuery)
>     {
>         addSelectionCriteria(new ExistsCriteria(subQuery, true));
>     }
> 
>     /**
>      * Answer true if no sub criteria available
>      * @return boolean
>      */
>     public boolean isEmpty()
>     {
>         return m_criteria.isEmpty();
>     }
> 
>     /**
>      * Gets the groupby for ReportQueries of all Criteria and Sub Criteria
>      * the elements are of class FieldHelper
>      * @return List of FieldHelper
>      */
>     List getGroupby()
>     {
>         List result = _getGroupby();
>         Iterator iter = getCriteria().iterator();
>         Object crit;
> 
>         while (iter.hasNext())
>         {
>             crit = iter.next();
>             if (crit instanceof Criteria)
>             {
>                 result.addAll(((Criteria) crit).getGroupby());
>             }
>         }
> 
>         return result;
>     }
> 
>     /**
>      * Gets the groupby for ReportQueries,
>      * the elements are of class Criteria.FieldHelper
>      * @return List of Criteria.FieldHelper
>      */
>     protected List _getGroupby()
>     {
>         return groupby;
>     }
> 
>     /**
>      * Adds a groupby fieldName for ReportQueries.
>      * @param fieldName The groupby to set
>      * @deprecated use QueryByCriteria#addGroupBy
>      */
>     public void addGroupBy(String fieldName)
>     {
>         if (fieldName != null)
>         {
>             _getGroupby().add(new FieldHelper(fieldName, false));
>         }
>     }
> 
>     /**
>      * Adds a field for groupby
>      * @param aField the Field
>      * @deprecated use QueryByCriteria#addGroupBy
>      */
>     public void addGroupBy(FieldHelper aField)
>     {
>         if (aField != null)
>         {
>             _getGroupby().add(aField);
>         }
>     }
> 
>     /**
>      * Adds an array of groupby fieldNames for ReportQueries.
>      * @param fieldNames The groupby to set
>      * @deprecated use QueryByCriteria#addGroupBy
>      */
>     public void addGroupBy(String[] fieldNames)
>     {
>         for (int i = 0; i < fieldNames.length; i++)
>         {
>             addGroupBy(fieldNames[i]);
>         }
>     }
> 
>     /**
>      * Returns the prefetchedRelationships.
>      * @return List
>      */
>     List getPrefetchedRelationships()
>     {
>         return prefetchedRelationships;
>     }
> 
>     /**
>      * add the name of a Relationship for prefetch read
>      * @param aName the name of the relationship
>      * @deprecated use QueryByCriteria#addPrefetchedRelationship
>      */
>     public void addPrefetchedRelationship(String aName)
>     {
>         getPrefetchedRelationships().add(aName);
>     }
> 
>     /**
>      * read the prefetchInLimit from Config based on OJB.properties
>      */
>     private static int getSqlInLimit()
>     {
>         try
>         {
>             PersistenceBrokerConfiguration config = (PersistenceBrokerConfiguration) PersistenceBrokerFactory
>                     .getConfigurator().getConfigurationFor(null);
>             return config.getSqlInLimit();
>         }
>         catch (ConfigurationException e)
>         {
>             return 200;
>         }
>     }
> 
> 	/**
> 	 * @return String
> 	 */
> 	public String getAlias()
> 	{
> 		return m_alias;
> 	}
> 
> 	/**
> 	 * @return String
> 	 */
> 	// PAW
> 	public UserAlias getUserAlias()
> 	{
> 		return m_userAlias;
> 	}
> 	
> 	// PAW
> 	/**
> 	 * Retrieves or if necessary, creates a user alias to be used
> 	 * by a child criteria 
> 	 * @param userAlias The alias to set
> 	 */
> 	private UserAlias getUserAlias(Object attribute)
> 	{
> 		if (m_userAlias != null)
> 		{
> 			return m_userAlias;
> 		}
> 		if (!(attribute instanceof String))
> 		{	
> 			return null;
> 		}
> 		if (m_alias == null)
> 		{
> 			return null;
> 		}
> 		if (m_aliasPath == null)
> 		{
> 			boolean allPathsAliased = true;
> 			return new UserAlias(m_alias, (String)attribute, allPathsAliased);
> 		}
> 		return new UserAlias(m_alias, (String)attribute, m_aliasPath);
> 	}
> 
> 
> 	/**
> 	 * Sets the alias. Empty String is regarded as null.
> 	 * @param alias The alias to set
> 	 */
> 	public void setAlias(String alias)
> 	{
> 		if (alias == null || alias.trim().equals(""))
> 		{
> 			m_alias = null;
> 		}
> 		else
> 		{
> 			m_alias = alias;
> 		}
> 
> 		// propagate to SelectionCriteria,not to Criteria
> 		for (int i = 0; i < m_criteria.size(); i++)
> 		{
> 			if (!(m_criteria.elementAt(i) instanceof Criteria))
> 			{
> 				((SelectionCriteria) m_criteria.elementAt(i)).setAlias(m_alias);
> 			}
> 		}
> 	}
> 
> 	// PAW
> 	/**
> 	 * Sets the alias. Empty String is regarded as null.
> 	 * @param alias The alias to set
> 	 * @param aliasPath The path segment(s) to which the alias applies
> 	 */
> 	public void setAlias(String alias, String aliasPath)
> 	{
> 		if (alias == null || alias.trim().equals(""))
> 		{
> 			m_alias = null;
> 		}
> 		else
> 		{
> 			m_alias = alias;
> 			m_aliasPath = aliasPath;
> 		}
> 
> 		// propagate to SelectionCriteria,not to Criteria
> 		for (int i = 0; i < m_criteria.size(); i++)
> 		{
> 			if (!(m_criteria.elementAt(i) instanceof Criteria))
> 			{
> 				((SelectionCriteria) m_criteria.elementAt(i)).setAlias(m_alias, aliasPath);
> 			}
> 		}
> 	}
> 
> 	// PAW
> 	/**
> 	 * Sets the alias using a userAlias object. 
> 	 * @param userAlias The alias to set
> 	 */
> 	public void setAlias(UserAlias userAlias)
> 	{
> 		m_alias = userAlias.getName();
> 
> 		// propagate to SelectionCriteria,not to Criteria
> 		for (int i = 0; i < m_criteria.size(); i++)
> 		{
> 			if (!(m_criteria.elementAt(i) instanceof Criteria))
> 			{
> 				((SelectionCriteria) m_criteria.elementAt(i)).setAlias(userAlias);
> 			}
> 		}
> 	}
> 
> 
>     /**
>      * @return the query containing the criteria
>      */
>     public QueryByCriteria getQuery()
>     {
>         if (getParentCriteria() != null)
>         {
>             return getParentCriteria().getQuery();
>         }
>         else
>         {
>             return m_query;
>         }
> 
>     }
> 
>     /**
>      * @param query
>      */
>     void setQuery(QueryByCriteria query)
>     {
>         m_query = query;
>     }
> 
>     /**
>      * @return the parent criteria
>      */
>     public Criteria getParentCriteria()
>     {
>         return m_parentCriteria;
>     }
> 
>     /**
>      * @param criteria
>      */
>     void setParentCriteria(Criteria criteria)
>     {
>         m_parentCriteria = criteria;
>     }
> 
>     /**
>      * @see Object#toString()
>      */
>     public String toString()
>     {
>         if (isNegative())
>         {
>             return "-" + m_criteria.toString();
>         }
>         else
>         {
>             return m_criteria.toString();
>         }
>     }
> 
>     /**
>      * @return Returns the negative.
>      */
>     public boolean isNegative()
>     {
>         return m_negative;
>     }
> 
>     /**
>      * Flags the whole Criteria as negative.
>      * @param negative The negative to set.
>      */
>     public void setNegative(boolean negative)
>     {
>         m_negative = negative;
>     }
> 
> 	// PAW    
> 	/**
> 	 * Add a hint Class for a path. Used for relationships to extents.<br>
> 	 * SqlStatment will use these hint classes when resolving the path.
> 	 * Without these hints SqlStatment will use the base class the
> 	 * relationship points to ie: Article instead of CdArticle.
> 	 *
> 	 * @param aPath the path segment ie: allArticlesInGroup
> 	 * @param aClass the Class ie: CdArticle
> 	 * @see org.apache.ojb.broker.QueryTest#testInversePathExpression()
> 	 */
> 	public void addPathClass(String aPath, Class aClass)
> 	{
> 		Object pathClasses = m_pathClasses.get(aPath);
> 		if(pathClasses == null)
> 		{
> 			setPathClass(aPath,aClass);
> 		}
> 		else
> 		{
> 			List hints = (List)pathClasses;
> 			hints.add(aClass);
> 			m_pathClasses.put(aPath, hints);
> 		}
> 	}
> 
> 	/**
> 	 * Set the Class for a path. Used for relationships to extents.<br>
> 	 * SqlStatment will use this class when resolving the path.
> 	 * Without this hint SqlStatment will use the base class the
> 	 * relationship points to ie: Article instead of CdArticle.
> 	 * Using this method is the same as adding just one hint
> 	 *
> 	 * @param aPath the path segment ie: allArticlesInGroup
> 	 * @param aClass the Class ie: CdArticle
> 	 * @see org.apache.ojb.broker.QueryTest#testInversePathExpression()
> 	 * @see #addPathClass
> 	 */
> 	public void setPathClass(String aPath, Class aClass)
> 	{
> 		List pathClasses = new ArrayList(1);
> 		pathClasses.add(aClass);
> 		m_pathClasses.put(aPath, pathClasses);
> 	}
> 
> 	/**
> 	 * Get the a List of Class objects used as hints for a path
> 	 *
> 	 * @param aPath the path segment ie: allArticlesInGroup
> 	 * @return a List o Class objects to be used in SqlStatment
> 	 * @see #addPathClass
> 	 * @see org.apache.ojb.broker.QueryTest#testInversePathExpression()
> 	 */
> 	public List getClassesForPath(String aPath)
> 	{
> 		return (List)getPathClasses().get(aPath);
> 	}
> 	
> 	/**
> 	 * Gets the pathClasses.
> 	 * A Map containing hints about what Class to be used for what path segment
> 	 * If local instance not set, try parent Criteria's instance.  If this is 
> 	 * the top-level Criteria, try the m_query's instance
> 	 * @return Returns a Map
> 	 */
> 	public Map getPathClasses()
> 	{
> 		if (m_pathClasses.isEmpty())
> 		{
> 			if (m_parentCriteria == null)
> 			{
> 				if (m_query == null)
> 				{
> 					return m_pathClasses;
> 				}
> 				else
> 				{
> 					return m_query.getPathClasses();
> 				}
> 			}
> 			else
> 			{
> 				return m_parentCriteria.getPathClasses();
> 			}
> 		}
> 		else
> 		{
> 			return m_pathClasses;
> 		}
> 	}
> 
> 	
> 
> }
> 
> 
> ------------------------------------------------------------------------
> 
> package org.apache.ojb.broker.query;
> 
> /* Copyright 2002-2004 The Apache Software Foundation
>  *
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  *
>  *     http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  */
> 
> /**
>  * Abstract superclass for Criteria using a field to compare with
>  * 
>  * @author <a href="mailto:jbraeuchi@hotmail.com">Jakob Braeuchi</a>
>  * @version $Id: FieldCriteria.java,v 1.8 2004/04/04 23:53:36 brianm Exp $
>  */
> public class FieldCriteria extends SelectionCriteria
> {
> 	// PAW
> //	static FieldCriteria buildEqualToCriteria(Object anAttribute, Object aValue, String anAlias)
> 	static FieldCriteria buildEqualToCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
>     {
>         return new FieldCriteria(anAttribute, aValue, EQUAL, anAlias);
>     }
> 
> 	// PAW
> //	static FieldCriteria buildNotEqualToCriteria(Object anAttribute, Object aValue, String anAlias)
> 	static FieldCriteria buildNotEqualToCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
>     {
>         return new FieldCriteria(anAttribute, aValue, NOT_EQUAL, anAlias);
>     }
> 
> 	// PAW
> //	static FieldCriteria buildGreaterCriteria(Object anAttribute, Object aValue, String anAlias)
> 	static FieldCriteria buildGreaterCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
>     {
>         return new FieldCriteria(anAttribute, aValue,GREATER, anAlias);
>     }
> 
> 	// PAW
> //	static FieldCriteria buildNotGreaterCriteria(Object anAttribute, Object aValue, String anAlias)
> 	static FieldCriteria buildNotGreaterCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
>     {
>         return new FieldCriteria(anAttribute, aValue, NOT_GREATER, anAlias);
>     }
> 
> 	// PAW
> //	static FieldCriteria buildLessCriteria(Object anAttribute, Object aValue, String anAlias)
> 	static FieldCriteria buildLessCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
>     {
>         return new FieldCriteria(anAttribute, aValue, LESS, anAlias);
>     }
> 
> 	// PAW
> //	static FieldCriteria buildNotLessCriteria(Object anAttribute, Object aValue, String anAlias)
> 	static FieldCriteria buildNotLessCriteria(Object anAttribute, Object aValue, UserAlias anAlias)
>     {
>         return new FieldCriteria(anAttribute, aValue, NOT_LESS, anAlias);
>     }
> 
> 	// BRJ: indicate whether field name should be translated into column name
> 	private boolean m_translateField = true;
>     private String m_clause;
> 
> 	/**
> 	 * Constructor declaration
> 	 *
> 	 * @param anAttribute  column- or fieldName
> 	 * @param aValue  the value to compare with
> 	 * @param negative  criteria is negated (ie NOT LIKE instead of LIKE)
> 	 * @param alias  use alias to link anAttribute to
> 	 */
> 	// PAW
> //	FieldCriteria(Object anAttribute, Object aValue, String aClause, String alias)
> 	FieldCriteria(Object anAttribute, Object aValue, String aClause, UserAlias alias)
> 	{
> 		super(anAttribute, aValue, alias, false);
>         m_clause = aClause;
> 	}
> 
>     /**
>      * @see SelectionCriteria#isBindable()
>      */
>     protected boolean isBindable()
>     {
>         return false;
>     }
> 
> 	/**
> 	 * @return true if field name should be translated into column name
> 	 */
> 	public boolean isTranslateField()
> 	{
> 		return m_translateField;
> 	}
> 
> 	/**
> 	 * @param b
> 	 */
> 	void setTranslateField(boolean b)
> 	{
> 		m_translateField = b;
> 	}
> 
>     /* (non-Javadoc)
>      * @see org.apache.ojb.broker.query.SelectionCriteria#getClause()
>      */
>     public String getClause()
>     {
>         return m_clause;
>     }
> }
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org

---------------------------------------------------------------------
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