• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate and Triggers  RSS feed

kartik krishnan
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a two tables t_profile and t_loan where t_loan has a standard foreign key relationship with t_profile (pk of t_profile is a fk in t_loan). I am implementing a trigger that will store an audit entry in the table t_loan_history when the loan is deleted for that profile.

Objects of type Loan and Profile are mapped to the table using hibernate mapping xml file.
To delete the loan from the web app , I am using HibernateTemplate to delete the loan as shown below:

I have a history table which is a mirror of the loan table in addition it's own primary key.

My trigger code to create loan delete audit:

When I run this code, this is the error that I get


However, ordinary sql query

to delete the loan from t_loan table deletes the loan entry and populates the history audit entry.

Am I doing anything wrong?
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!