tags:

views:

90

answers:

2

Is it possible to get the year or month out from a date filed with ejbql like this pseudo code select year(createdDate), name from table group by year(createdDate) ?

Best regards Anders Olme

A: 

Get the date, and do it in your code. You can use Java Calendar API for this.

Adeel Ansari
A: 

No, you must examine the Date object that the query returns yourself by converting it to a Calendar and then using get(Calendar.YEAR) on it.

Aaron Digulla
Oki, I'm converting some code from websphere to glassfish and the functions where available there. Guess I have to do it manually then :).//olme
Buzzzz
There is no extension framework for toplink that would make such statements possible?
Buzzzz
He meant don't do it like that. And he is quite right and serious.
Adeel Ansari
OK, just that it would make the porting a bit easier since I don't have to introduce new logic. But since it not possible I guess I have no choice :)./olme
Buzzzz