[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.rt.eclipselink] Create additional views on session start

Hi,

I need to create an additional view so that my Entity class can reference that view as its table.
Where can I create views before EL tries to map the Entity classes to database tables?
Using a SessionCustomizer and if so how would I do that?


Thats the view I would need to create:
CREATE OR REPLACE FORCE VIEW "ORDERS_PROGRESS" ("AUF_NR", "DONE", "SHORTFALLS") AS
select
o.auf_nr as auf_nr,
100 * (select count(*) from auftrags_positionen where auf_nr=o.auf_nr and status!=1) / count(*) as done,
100 * (select count(*) from auftrags_positionen where auf_nr=o.auf_nr and status=6) / count(*) as shortfalls
from
auftrags_positionen p, auftraege o where p.auf_nr = o.auf_nr
group by o.auf_nr


Thanks,
Phil