Sum duration

90 views
Skip to first unread message

Diego

unread,
Feb 1, 2020, 4:16:23 AM2/1/20
to Querydsl
Hello,

It's possible an query dsl to use sum with type Duration in java?

Prasad B

unread,
Feb 1, 2020, 12:03:22 PM2/1/20
to Querydsl on behalf of Diego
Didn't get your question? Can you please provide the SQL which you are trying to generate using query dsl?

On Sat 1 Feb, 2020, 2:46 PM Diego via Querydsl <querydsl+APn2wQcBy86PqVRnMgFy2BU...@googlegroups.com wrote:
Hello,

It's possible an query dsl to use sum with type Duration in java?

--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/querydsl/e3979ba8-7b8f-45ba-b9a2-76c1d116b682%40googlegroups.com.

Diego

unread,
Feb 4, 2020, 5:04:37 PM2/4/20
to Querydsl

Sorry, there is no query yet because when trying to use Group By.sum, for example, only Number is accepted and my field is of type Duration. I would like to know if there is a way to sum a field like mine that is of type Duration. Thanks for listening!


Em sábado, 1 de fevereiro de 2020 14:03:22 UTC-3, Prasad B escreveu:
Didn't get your question? Can you please provide the SQL which you are trying to generate using query dsl?

On Sat 1 Feb, 2020, 2:46 PM Diego via Querydsl <querydsl+APn2wQcBy86PqVRnMgFy2BUhXCCEAdxHcoVTAGcjt3X_AbGGP_5Lfs4@googlegroups.com wrote:
Hello,

It's possible an query dsl to use sum with type Duration in java?

--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quer...@googlegroups.com.

Jan-Willem Gmelig Meyling

unread,
Jan 27, 2021, 7:54:33 PM1/27/21
to Querydsl
It all depends on the targetted database or language.

For querydsl-jpa, its only possible if you mapped the Duration to a duration type for your database through a custom type. You then need to generate the appropiate metamodel for it and register some custom functions. For the combination Hibernate / PostgreSQL / Hibernate-Types I've got this to work. The code is available at https://github.com/jwgmeligmeyling/hibernate-types-querydsl-apt .

Different databases are going to require an alternative solution. And the solution is going to be different for i.e. `querydsl-sql` or `querydsl-collections` as well.


Op dinsdag 4 februari 2020 om 23:04:37 UTC+1 schreef Diego:

Sorry, there is no query yet because when trying to use Group By.sum, for example, only Number is accepted and my field is of type Duration. I would like to know if there is a way to sum a field like mine that is of type Duration. Thanks for listening!


Em sábado, 1 de fevereiro de 2020 14:03:22 UTC-3, Prasad B escreveu:
Didn't get your question? Can you please provide the SQL which you are trying to generate using query dsl?

Reply all
Reply to author
Forward
0 new messages