oracle database trigger and INSERT problem [message #545313] |
Wed, 07 July 2010 08:23  |
Eclipse User |
|
|
|
Hi,
I do my first steps with eclipselink as JPA implementation in glassfish and I encountered a problem related to a trigger.
I have a table called TRACE in an oracle DB which I fill with JPA. As long as I have no trigger on this table all is fine. In particular I can INSERT records.
But when I enable a "BEFORE INSERT" trigger which fills a day_of_month field by a date (trace_date) inserted I get no error in log-file but the recods is not persisted in the database.
Entity Trace:
...
@Column(nullable = true)
@Temporal(TemporalType.TIMESTAMP)
private Date trace_date;
...
@Column(nullable = true)
private Byte day_of_month;
...
Trigger:
CREATE OR REPLACE TRIGGER TRACE_I_TR
BEFORE INSERT
ON cobra.trace
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
DECLARE
v_id number;
BEGIN
:new.day_of_month:= to_number(to_char(:new.trace_date,'DD'));
END;
/
What should I do to enable coexistence between database triggers and JPA?
Thomas
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05321 seconds