dev@glassfish.java.net

Re: Fix for issue 860

From: Markus Fuchs <Markus.Fuchs_at_Sun.COM>
Date: Thu, 27 Jul 2006 12:35:33 -0700
This messages was intended for the persistence alias only. Please include only persistence@glassfish.com in your reply.

-- markus.

Markus Fuchs wrote:
Hi Tom,

attached is a fix for issue 860: Running out of memory--JOINED Inheritance w/ secondary table

The problem is basically that the generated query is missing joins for the tables of the JOINED inheritance, only the join for the secondary table is there.

I modified two classes:

ExpressionBuilder:

moved

>         if (isUsingOuterJoinForMultitableInheritance() && (!getSession().getPlatform().shouldPrintOuterJoinInWhereClause())) {
>             normalizer.getStatement().getOuterJoinExpressions().addElement(null);
>             normalizer.getStatement().getOuterJoinedMappingCriteria().addElement(null);
>             normalizer.getStatement().getOuterJoinedAdditionalJoinCriteria().addElement(additionalExpressionCriteriaMap());
>             normalizer.getStatement().getDescriptorsForMultitableInheritanceOnly().add(this.getDescriptor());
>             // fall through to the main case
...

out of the

        if (!this.wasAdditionJoinCriteriaUsed && this.queryClass != null) {

check. Above lines seems to initiate the addition of joins for the inheritance tables to the query, and should be *always* executed.

SQLSelectStatement:

The secondary table ORDER_SEC is not contained in the Map "tablesJoinExpressions", as this map only contains outer joined tables. So the statement

          Expression onExpression = (Expression)tablesJoinExpressions.get(table);

returns null.

As I'm not totally sure, how outer joins for inheritance and secondary tables are processed by TopLink, this is my best guess of fixing issue 860. It would be great, if somebody for the TopLink team could give me more inside into these two topics. Maybe somebody could educate me over the phone...

With the fix, the correct SQL query is generated, and entity-persistence-tests pass against Derby.

Thanks,

-- markus.


--------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@glassfish.dev.java.net For additional commands, e-mail: dev-help@glassfish.dev.java.net