persistence@glassfish.java.net

RE: entity persistence update

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Tue, 7 Mar 2006 11:48:25 -0500

Yes Michael,
        The supplied code is almost identical to what I changed. Except we always know that the result of the performOperator will be a FunctionExpression.
--Gordon

-----Original Message-----
From: Michael Bouschen [mailto:Michael.Bouschen_at_Sun.COM]
Sent: Tuesday, March 07, 2006 11:42 AM
To: Gordon Yorke
Cc: persistence_at_glassfish.dev.java.net
Subject: Re: entity persistence update


Hi Gordon,

> Hello Michael,
> I have tracked down the aggregate function return type regression and fixed it, the resolution will be in the next CVS drop. I have also added regression tests to detect the problem.

Great! I'm just curious, how does the fix look like? I briefly looked
into this today, too, and figured out that the problem might be in
FunctionExpression method rebuildOn. It creates a new FunctionExpression
instance w/o copying over the result type. I changed the last line in
method rebuildOn to
         Expression expr = newLocalBase.performOperator(getOperator(),
newChildren);
         if (expr.isFunctionExpression()) {
             ((FunctionExpression)expr).setResultType(getResultType());
         }
         return expr;
With this change my aggregate test query suceeds and retruns the
expected value.

Regards Michael

> --Gordon
>
> -----Original Message-----
> From: Michael Bouschen [mailto:Michael.Bouschen_at_Sun.COM]
> Sent: Friday, March 03, 2006 2:47 PM
> To: Tom Ware; Gordon Yorke
> Cc: persistence_at_glassfish.dev.java.net
> Subject: Re: entity persistence update
>
>
> Hi Tom, hi Gordon,
>
> I'm running into two issues after updating my workspace:
> - The testcase multipleParameterTest in entity-persistence-tests fails
> throwing an IllegalStateException saying: "Attempting to execute an
> operation on a closed EntityManager.". You find my testsresults.txt file
> attached below.
> - EJBQL aggregate queries using AVG, SUM or COUNT return the correct
> value of the wrong type, e.g. "SELECT COUNT(o) FROM Order o" returns a
> BigDecimal instance instead of a Long.
>
> Do you have an idea? Is there anything wrong with my environment?
>
> Regards Michael
>
>
>>Issue number: entity-persistence-updates
>>Obtained from: TopLink
>>Submitted by: Tom Ware
>>Reviewed by: TopLink team
>>
>>-Handling of Persistence Unit defaults for schema and catalog, part 2
>>and now complete. Includes cleanup of logging messages, code
>>re-factoring and cleanup.
>>-Handling of Persistence Unit defaults for schema and catalog, part 1.
>>Includes cleanup of logging messages, code re-factoring and cleanup.
>>delayed ejbql query parsing till login to add constructor expression
>>support for inheritance
>>-em close method behaviour changed: if em associated with an active
>>transaction then closure postponed until the transaction completes.
>>--added FETCH JOIN support to TopLink Report Queries
>>Fixed an error in the metadata complete test.
>>-Refactored TopLink Weaving
>>
>>Tested with full GlassFish build, QuickLook tests, entity-persistence
>>tests, oracle-internal tests and ejb 3 persistence dev tests
>>
>
>
>
>