FAQ
Instantiation of wrong Classes if more the 1 class has the same name (within different packages)
------------------------------------------------------------------------------------------------

Key: CAY-521
URL: http://issues.apache.org/cayenne/browse/CAY-521
Project: Cayenne
Type: Bug

Versions: 1.2 [BETA]
Reporter: Ayhan Kondoz


Hello,

i found following bug in cayenne 1.2B1 and B2. I know that cayenne 1.1 did not have this bug.

I have 2 databases and in each database I have a table with the same name. The java classes for the nodes have different packages so the created java classes work fine and there is no conflict with multiple classes that have the same name. However when use a SelectQuery to get a list of objects from the database the returned list always contains objects from the same package so I get a ClassCastException when I try to cast them into the correct object. For Example


Database 1:
Table: mandant
Class: x.y.Mandant


Database 2:
Table: mandant
Class: x.z.Mandant


SelectQuery query = new SelectQuery(x.z.Mandant.class)

List list = context.performQuery(query);


Iterator iter = list.iterator();

while ( iter.hasNext() ) {
x.z.Mandant m = (x.z.Mandant)iter.next(); // ClassCastException
....
}


Further tests showed that the object within the list is an instance of x.y.Mandant instead of x.z.Mandant, hence the ClassCastException.

cheers

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/cayenne/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categoriescayenne
postedApr 20, '06 at 12:43p
activeApr 20, '06 at 12:43p
posts1
users1
websitecayenne.apache.org

1 user in discussion

Ayhan Kondoz (JIRA): 1 post

People

Translate

site design / logo © 2022 Grokbase