Hallo,
ich habe eine Tabelle erzeugt in der das Datum mit timestamp geseichert wird.
Code:
CREATE TABLE item
(
id bigint NOT NULL,
date timestamp without time zone,
username character varying(15) NOT NULL,
host bigint,
application bigint,
CONSTRAINT item_pkey1 PRIMARY KEY (id),
CONSTRAINT fk22ef337af172d2 FOREIGN KEY (application)
REFERENCES application (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk22ef338c73775e FOREIGN KEY (host)
REFERENCES host (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS=FALSE);
ALTER TABLE item OWNER TO application_logging;
Nun möchte ich abfragen wie viele Einträge es pro Tag gab. In SQL mache ich das mit der Abfrage
Code:
select date::date, count(date::date) from item where application=21443 group by date::date order by date::date
Wenn ich es nun mit Hibernate versuche bekomme ich die Fehlermeldung
Abfrage
Code:
Query q = session.createSQLQuery(
"select date::date, count(date::date) from item " +
"where application = 21443 " +
"group by date::date order by date::date)");
List results = q.list()
Fehlermeldung
Code:
Exception in thread "main" org.hibernate.QueryException: Not all named parameters have been set: [:date] [select date::date, count(date::date) from item where application = 21443 group by date::date order by date::date)]
Hat jemand eine Idee wie ich den Konstrukt date::date in Hibernate formulieren muss.
Danke für Eure Hilfe
Christian