Bug 104990 - Can't use a path to a link attribute with DataQuery#addOrder(String order)
Summary: Can't use a path to a link attribute with DataQuery#addOrder(String order)
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Web Application Framework
Classification: Retired
Component: persistence
Version: nightly
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Archit Shah
QA Contact: Jon Orris
URL:
Whiteboard:
Depends On:
Blocks: 108447
TreeView+ depends on / blocked
 
Reported: 2003-09-24 13:39 UTC by Daniel Berrangé
Modified: 2007-04-18 16:57 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-11-14 20:23:53 UTC
Embargoed:


Attachments (Terms of Use)

Description Daniel Berrangé 2003-09-24 13:39:17 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.9 (X11; Linux i686; U;) Gecko/20030314

Description of problem:
It does not appear to be possible to specifiy a path to a link attribute for the
addOrder(String) method of DataQuery. Consider the following example (against
the Troika categorization object model):

     Category theCategory = new Category(new OID(Category.BASE_DATA_OBJECT_TYPE,
new BigDecimal(531)));
     DataCollection events =
SessionManager.getSession().retrieve("com.arsdigita.cms.contenttypes.Event");
     events.addEqualsFilter("parent.categories.id", theCategory.getID());
     events.addEqualsFilter("language", "en");
     events.addOrder("parent.categories.link.sortKey");

while (events.next()) {
    DataObject o = events.getDataObject();
    System.err.println(o.getOID());
}

This generates an exception:

com.arsdigita.persistence.PersistenceException:  (root cause:
com.redhat.persistence.engine.rdbms.QGen$5: unknown value in expression:
parent.categories.link.sortKey
query signature: com.arsdigita.cms.contenttypes.Event(id, objectType,
displayName, defaultDomainClass, isDeleted, version, name, language, ancestors,
title, launchDate, startDate, endDate, startTime, endTime, eventDate, location,
lead, mainContributor, eventType, mapLink, cost))
	at
com.arsdigita.persistence.PersistenceException.newInstance(PersistenceException.java:137)
	at
com.arsdigita.persistence.PersistenceException.newInstance(PersistenceException.java:109)
	at com.arsdigita.persistence.DataQueryImpl.next(DataQueryImpl.java:458)


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Write a query similar to above code fragment
2. Try to run it
    

Additional info:

Comment 1 Daniel Berrangé 2003-09-24 13:45:32 UTC
Opps, should have pasted the root cause stack trace:

Root cause: 
com.redhat.persistence.engine.rdbms.QGen$5: unknown value in expression:
parent.categories.link.sortKey
query signature: com.arsdigita.cms.contenttypes.Event(id, objectType,
displayName, defaultDomainClass, isDeleted, version, name, language, ancestors,
title, launchDate, startDate, endDate, startTime, endTime, eventDate, location,
lead, mainContributor, eventType, mapLink, cost)
	at com.redhat.persistence.engine.rdbms.QGen$4.map(QGen.java:660)
	at com.redhat.persistence.common.SQLParser.identifier(SQLParser.java(Compiled
Code))
	at
com.redhat.persistence.common.SQLParser.unstructuredElementNoComma(SQLParser.java(Compiled
Code))
	at
com.redhat.persistence.common.SQLParser.unstructuredElement(SQLParser.java(Compiled
Code))
	at com.redhat.persistence.common.SQLParser.sql(SQLParser.java:229)
	at com.redhat.persistence.engine.rdbms.QGen$2.onPassthrough(QGen.java:666)
	at com.redhat.persistence.Expression$Passthrough.dispatch(Expression.java:95)
	at com.redhat.persistence.engine.rdbms.QGen.generate(QGen.java(Inlined Compiled
Code))
	at com.redhat.persistence.engine.rdbms.QGen.generate(QGen.java(Compiled Code))
	at com.redhat.persistence.engine.rdbms.RDBMSEngine.execute(RDBMSEngine.java:231)
	at com.redhat.persistence.engine.rdbms.RDBMSEngine.execute(RDBMSEngine.java:223)
	at com.redhat.persistence.Cursor.execute(Cursor.java:125)
	at com.redhat.persistence.Cursor.next(Cursor.java:109)
	at com.arsdigita.persistence.DataQueryImpl.next(DataQueryImpl.java:456)


Comment 2 Archit Shah 2003-11-26 22:28:09 UTC
this should work now. The test of this functionality is
DynamicLinkAttributeTest#deepLink


Note You need to log in before you can comment on or make changes to this bug.