Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » oracle database trigger and INSERT problem
oracle database trigger and INSERT problem [message #545313] Wed, 07 July 2010 12:23 Go to next message
No real name is currently offline No real nameFriend
Messages: 2
Registered: July 2010
Junior Member
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

Re: oracle database trigger and INSERT problem [message #545639 is a reply to message #545313] Thu, 08 July 2010 13:34 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Are you sure your trigger is valid?

Can you insert through raw SQL, or raw JDBC?

Enable logging and ensure the SQL is sent, and the transaction is committed.


James : Wiki : Book : Blog : Twitter
Re: oracle database trigger and INSERT problem [message #546375 is a reply to message #545639] Mon, 12 July 2010 15:10 Go to previous message
No real name is currently offline No real nameFriend
Messages: 2
Registered: July 2010
Junior Member
James wrote on Thu, 08 July 2010 09:34
Are you sure your trigger is valid?

Can you insert through raw SQL, or raw JDBC?

Enable logging and ensure the SQL is sent, and the transaction is committed.



Hi , thank you. The trigger was valid bit it was really my fault. The SELECT I checked the result was simply wrong Sad.

Thomas
Previous Topic:JPA 2.0 and WebLogic 10
Next Topic:javax.persistence api 2.0 for maven
Goto Forum:
  


Current Time: Fri Mar 29 07:05:57 GMT 2024

Powered by FUDForum. Page generated in 0.03048 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top