This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate and Triggers

kartik krishnan
Ranch Hand
Posts: 63
  • 0
  • 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?
I agree. Here's the link:
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic