Hi Sascha,
thank you very much for testing the RC1!
Sascha Broich wrote:
Hello,
I found a bug in
org.apache.ojb.broker.core.CollectionTypes#getCollectionClass(Collection
Descriptor).
The "isAssignableFrom" check has to be inverted.
For instance:
HashSet.class.isAssignableFrom(Set.class) yields false and a
MetadataException is thrown.
Inverted to Set.class.isAssignableFrom(HashSet.class) yields true and
the correct branch gets entered.
The method CollectionTypes#getCollectionClass is correctly implemented.
First this method checks for user specific collection class
implementations (implementations of ManageableCollection), then this
method try to resolve the collection class implementations for 1:n and
m:n collection-fields (of type Collection, List, Set or array types) of
persistence capable classes.
The "real bug" is a typo in the OJB.properties file:
replace
CollectionTypes.OneToManySet=org.apache.ojb.broker.util.collections.ManageableSet
with
CollectionTypes.OneToManySet=org.apache.ojb.broker.util.collections.ManageableHashSet
I will fix this ASAP. Thanks again.
Another bug is in the statement creation when a subclass is involved.
Note: A0 is the subclass table from A1, PHB_USRID exists only in A1
1.0.4 creates something like
SELECT
A0.PHB_ID ,
A1.PHB_USRID ,
FROM
IPT_PHONEBOOKCSV A0
INNER JOIN IPT_PHONEBOOK A1
ON
A0.PHB_ID = A1.PHB_ID
WHERE
PHB_USRID IS NULL
1.0.5rc1 creates
SELECT
A0.PHB_ID ,
A1.PHB_ID ,
A1.PHB_USRID ,
FROM
IPT_PHONEBOOKCSV A0
INNER JOIN IPT_PHONEBOOK A1
ON
A0.PHB_ID = A1.PHB_ID
WHERE
A0.PHB_USRID IS NULL
The WHERE criteria assignment to A0 the statement produces an exception
for the nonexisting column A0.PHB_USRID.
Note, that in the SELECT of 1.0.5rc1 is also A1.PHB_ID, which is not in
the statement of 1.0.4.
If PHB_USRID only exists in A1 then A1 is a subclass of (super) class
A0. In this case it's not allowed to build a query with target class A0
and fields only existing in A1.
Is this the case? If not, please post some more details (java pseudo
code, class mapping).
regards,
Armin
Regards,
Sascha Broich
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]