Bug 104889

Summary: DataQuery#addPath() doesn't work if the association has link attributes
Product: [Retired] Red Hat Web Application Framework Reporter: Daniel Berrangé <berrange>
Component: persistenceAssignee: Archit Shah <archit.shah>
Status: CLOSED RAWHIDE QA Contact: Jon Orris <jorris>
Severity: medium Docs Contact:
Priority: medium    
Version: nightly   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-09-02 17:43:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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

Description of problem:
Attempting to add a path that crosses an association with link attributes does
not work.

 For example, my model looks like:

object type AtoZCategoryProvider extends AtoZProvider {
    Boolean isCompound = atoz_cat_provider.is_compound BIT;

    reference key (atoz_cat_provider.provider_id);
}

association {
  AtoZCategoryProvider[0..n] atozProvider = join cat_categories.category_id
                                              to atoz_cat_provider_map.category_id,
                                            join atoz_cat_provider_map.provider_id
                                              to atoz_cat_provider.provider_id;
  Category[0..n] atozEntries = join atoz_cat_provider.provider_id
                                 to atoz_cat_provider_map.provider_id,
                               join atoz_cat_provider_map.category_id
                                 to cat_categories.category_id;
  Boolean[1..1] isVisible = atoz_cat_provider_map.is_visible BIT;
}


For example, if I then do:

  DataCollection c =
SessionManager.getSession().retrieve("com.arsdigita.london.atoz.AtoZCategoryProvider");
  c.addPath("atozEntries.name");
  c.addEqualsFilter("atozEntries.id", catID);
  
  System.err.println("---Entries---");
  while (c.next()) {
    DataObject o = c.getDataObject();
    System.err.println(o);
    System.err.println("Entry: " + c.get("atozEntries.name"));
  }
  System.err.println("---Done---");

then an exception is thrown:

  java.lang.IllegalStateException: no mapping for: atozEntries
        at com.redhat.persistence.engine.rdbms.QGen$1.onStatic(QGen.java:616)
        at com.redhat.persistence.metadata.Static.dispatch(Static.java:40)
        at
com.redhat.persistence.engine.rdbms.QGen.genPathRecursive(QGen.java(Compiled Code))
        at
com.redhat.persistence.engine.rdbms.QGen.genPathRecursive(QGen.java(Compiled Code))
        at com.redhat.persistence.engine.rdbms.QGen.genPath(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)

If I comment out the 'isVisible' link attribute in the association it works as
expected.


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


How reproducible:
Always

Steps to Reproduce:
1. See above code


Additional info:

Comment 1 Daniel Berrangé 2003-09-24 13:32:12 UTC
I have further tested this & verified it also affects paths supplied to filters.
For example (with 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");
     while (events.next()) {
        ....
     }


Results in:

java.lang.IllegalStateException: no mapping for: categories
	at com.redhat.persistence.engine.rdbms.QGen$1.onStatic(QGen.java:616)
	at com.redhat.persistence.metadata.Static.dispatch(Static.java:40)
	at com.redhat.persistence.engine.rdbms.QGen.genPathRecursive(QGen.java(Compiled
Code))
	at com.redhat.persistence.engine.rdbms.QGen.genPathRecursive(QGen.java(Compiled
Code))
	at com.redhat.persistence.engine.rdbms.QGen.genPath(QGen.java(Inlined Compiled
Code))
	at com.redhat.persistence.engine.rdbms.QGen.access$500(QGen.java(Compiled Code))
	at com.redhat.persistence.engine.rdbms.QGen$4.map(QGen.java:650)
	at com.redhat.persistence.common.SQLParser.parens(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(Inlined
Compiled Code))
	at
com.redhat.persistence.engine.rdbms.RDBMSEngine.execute(RDBMSEngine.java(Compiled
Code))
	at com.redhat.persistence.Cursor.execute(Cursor.java(Inlined Compiled Code))
	at com.redhat.persistence.Cursor.next(Cursor.java(Compiled Code))
	at com.arsdigita.persistence.DataQueryImpl.next(DataQueryImpl.java(Compiled Code))


Comment 2 Rafael H. Schloming 2003-11-27 02:37:57 UTC
There is now a test that verifies that this is fixed on the trunk.

Comment 3 David Lawrence 2006-07-18 03:44:29 UTC
QA_READY has been deprecated in favor of ON_QA. Please use ON_QA in the future.
Moving to ON_QA.

Comment 4 Daniel Berrangé 2006-09-02 17:43:11 UTC
Closing old tickets