users@glassfish.java.net

questian regarding persistence and database trigger

From: <thomas_at_randspringer.de>
Date: Wed, 7 Jul 2010 11:47:46 +0200 (CEST)

Hi,
 
I do my first steps with glassfish and JPA (eclipselink).
 
I have an EJB which INSERTs a record in a oracle-database-table via JPA.
 
It works fine when I DISABLE the following trigger on this table:
 
>snip
 
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;
/
 
>snip
 
When I enable the trigger the record is not persisted (after I run my program it is not in the database).
 
The trigger works on a Oracle-DATE field.
 
In my entity-class I have the following:
 
>snip
@Column(nullable = true)
@Temporal(TemporalType.TIMESTAMP)   
private Date trace_date;
>snip
 
It works also not with @Temporal(TemporalType.DATE)
 
How could I use the JPA-layer with this trigger together?
 
Best regards
Thomas