Hello,

I'm sorry, I overlooked that bit. Yes, a alias column expression is no
longer an aggregate function, so you'll need to assign it to
Field<Integer>. You hardly ever need to keep references of type
AggregateFunction<T>, unless you want to continue calling DSL methods on
it, that transform the aggregate function into a window function, for
instance...

I'm not sure if this makes sense to you...?

Cheers
Lukas

2015-03-30 13:54 GMT+02:00 <[email protected]>:

> Hi.. thanks..
>
> But if I use:
>
> AggregateFunction<Integer> fieldCount = sum(fieldByName(BigDecimal.class,
> "measure", measure.getColumnName())).as(
>                         measure.getColumnName());
>
> I have this error:
>
> Type mismatch: cannot convert from Field<Integer> to
> AggregateFunction<Integer>  or
>
> if i use AggregateFunction<Integer> fieldCount =
> (AggregateFunction<Integer>) count(fieldByName(BigDecimal.class, "measure",
>
> measure.getColumnName())).as(measure.getColumnName());
>
> In runtime, i have:  org.jooq.impl.FieldAlias cannot be cast to
> org.jooq.AggregateFunction
>
>
>
>
>
>
> Em sexta-feira, 27 de março de 2015 09:06:20 UTC-3, [email protected]
> escreveu:
>>
>> Hi,
>>
>> Jooq not generate alias to AggregateFunction<T> in MySQL
>>
>> Example:
>>
>>
>> AggregateFunction<Integer> fieldCount = sum(fieldByName(BigDecimal.class,
>> "measure", measure.getColumnName()).as(
>>                         measure.getColumnName()));
>>
>> ...
>>
>>
>> DSLContext create = using(con, SQLDialect.MYSQL);
>> create.select(fieldCount).from(TABLE);
>>
>>
>> Generate:
>>
>>      SELECT SUM(med_field) from TABLETEST;
>>
>>
>> Thanks.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to