Bug 104102 - Improper handling of associations in DataQuery.addPath()
Improper handling of associations in DataQuery.addPath()
Status: CLOSED WONTFIX
Product: Red Hat Web Application Framework
Classification: Retired
Component: persistence (Show other bugs)
6.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Archit Shah
Jon Orris
:
Depends On:
Blocks: 108447
  Show dependency treegraph
 
Reported: 2003-09-09 17:06 EDT by Mike Bonnet
Modified: 2007-04-18 12:57 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-11-10 16:02:52 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
A testcase that reproduces the bug. (16.10 KB, application/octet-stream)
2003-09-09 17:14 EDT, Mike Bonnet
no flags Details

  None (edit)
Description Mike Bonnet 2003-09-09 17:06:57 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.7 (X11; Linux i686; U;) Gecko/20030131

Description of problem:
DataQuery.addPath() will allow you to add a path to a [0..n] association, and to
filter on that path.  This is a very useful feature, and fills long-standing gap
in Persistence functionality (the ability to add joins to a query in real time).

However, if you then try to retrieve the [0..n] association that you filtered
on, you'll get a ClassCastException.  While you should be retrieving a
DataAssociation, persistence is returning a DataObject, and this causes the CCE.

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


How reproducible:
Always

Steps to Reproduce:
See first attachment for a reproducable test case

Additional info:
Comment 1 Mike Bonnet 2003-09-09 17:14:26 EDT
Created attachment 94340 [details]
A testcase that reproduces the bug.

This is a simple application that reproduces the bug.  To use it, you must have
the CCM development environment installed.

1. Create a new project called testing: $ ccm-devel-create.pl testing
2. $ ccm-profile testing
3. Delete all the generated files: $ cd .. && rm -rf testing
4. Untar the attachment into the current directory: $ tar xzvf
add-path-test.tar.gz
5. Edit config.vars for you environment.
6. Load the data model for Core and the testing project.
7. ant runtests

The tests should complete successfully.  Instead, you'll see a
ClassCastException like this:

java.lang.ClassCastException: com.arsdigita.persistence.DataObjectImpl
	at
com.arsdigita.persistence.DataAssociationCursorImpl.<init>(DataAssociationCursorImpl.java:38)

	at
com.arsdigita.persistence.DataAssociationImpl.<init>(DataAssociationImpl.java:39)

	at
com.arsdigita.persistence.DataObjectImpl.get(DataObjectImpl.java:167)
	at com.arsdigita.domain.DomainObject.get(DomainObject.java:436)
	at test.Foo.getBarAssociations(Foo.java:28)
	at test.FooTest.testAddPath(FooTest.java:39)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

	at
com.arsdigita.tools.junit.framework.BaseTestCase.runBare(BaseTestCase.java:47)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
	at
com.arsdigita.tools.junit.extensions.BaseTestSetup$1.protect(BaseTestSetup.java:60)

	at
com.arsdigita.tools.junit.extensions.BaseTestSetup.run(BaseTestSetup.java:64)
Comment 2 Rafael H. Schloming 2003-11-26 21:51:16 EST
I think this is actually fixed on the trunk now since it is just
another manifestation of bug 104889. We should probably add the test
case you've supplied to the persistence test suite before closing this
though.

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