org.kuali.kfs.module.purap.dataaccess.impl
Class PurapItemQueryCustomizer
java.lang.Object
org.apache.ojb.broker.accesslayer.QueryCustomizerDefaultImpl
org.kuali.kfs.module.purap.dataaccess.impl.KualiQueryCustomizerDefaultImpl
org.kuali.kfs.module.purap.dataaccess.impl.PurapItemQueryCustomizer
- All Implemented Interfaces:
- Serializable, org.apache.ojb.broker.accesslayer.QueryCustomizer, org.apache.ojb.broker.metadata.AttributeContainer
public class PurapItemQueryCustomizer
- extends KualiQueryCustomizerDefaultImpl
This class improves the default order by in OJB by enforcing consistency between Oracle and MySQLs handling of Null values in a
column. Oracle by default sorts nulls last while MySQL does nulls first (i.e. 1,2,3,null MySQL:null,1,2,3; Oracle:1,2,3,null To
get Mysql to sort correctly we need to negate the field that is being Sorted on (i.e. ORDER BY -column DESC = 1,2,3,null while
ORDER BY column DESC = 3,2,1,null) the oracle default for ORDER BY is "NULLS LAST" which the above MySQL tweak should make it
like. This could be improved to pass in nullsFirst to decide which way to display but that would be beyond what ojb currently
does
- See Also:
- Serialized Form
Method Summary |
org.apache.ojb.broker.query.Query |
customizeQuery(Object anObject,
org.apache.ojb.broker.PersistenceBroker broker,
org.apache.ojb.broker.metadata.CollectionDescriptor cod,
org.apache.ojb.broker.query.QueryByCriteria query)
In addition to what the referenced method does, this also fixes a mysql order by issue (see class comments) |
Methods inherited from class org.apache.ojb.broker.accesslayer.QueryCustomizerDefaultImpl |
addAttribute, getAttribute, getAttribute |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MYSQL_NEGATION
protected static final String MYSQL_NEGATION
- See Also:
- Constant Field Values
ORDER_BY_FIELD
public static final String ORDER_BY_FIELD
- See Also:
- Constant Field Values
ASCENDING
public static final String ASCENDING
- See Also:
- Constant Field Values
DESCENDING
public static final String DESCENDING
- See Also:
- Constant Field Values
PurapItemQueryCustomizer
public PurapItemQueryCustomizer()
customizeQuery
public org.apache.ojb.broker.query.Query customizeQuery(Object anObject,
org.apache.ojb.broker.PersistenceBroker broker,
org.apache.ojb.broker.metadata.CollectionDescriptor cod,
org.apache.ojb.broker.query.QueryByCriteria query)
- In addition to what the referenced method does, this also fixes a mysql order by issue (see class comments)
- Specified by:
customizeQuery
in interface org.apache.ojb.broker.accesslayer.QueryCustomizer
- Overrides:
customizeQuery
in class org.apache.ojb.broker.accesslayer.QueryCustomizerDefaultImpl
- See Also:
QueryCustomizerDefaultImpl.customizeQuery(java.lang.Object,
org.apache.ojb.broker.PersistenceBroker, org.apache.ojb.broker.metadata.CollectionDescriptor,
org.apache.ojb.broker.query.QueryByCriteria)
Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.