Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hello,
I have two tables(dept2, emp2) as below.
--- from --
create table dept2
( deptno number
, deptname varchar2(10)
, salsum number ) ;
alter table dept2 add constraint dept2_pk primary key(deptno) ;
create table emp2
( empno number
, empname varchar2(10)
, sal number
, deptno number ) ;
alter table emp2 add constraint emp2_pk primary key(empno) ;
alter table emp2 add constraint emp2_fk foreign key(deptno) refrences dept2(deptno);
insert into dept2 values ( 10,'DEPT10', 100) ;
insert into dept2 values ( 20,'DEPT20', 200) ;
insert into dept2 values ( 30,'DEPT30', 300) ;
insert into emp2 values ( 11,'EMP11',100,10) ;
insert into emp2 values ( 21,'EMP21',100,20) ;
insert into emp2 values ( 22,'EMP22',100,20) ;
insert into emp2 values ( 31,'EMP31',100,30) ;
insert into emp2 values ( 32,'EMP32',100,30) ;
insert into emp2 values ( 33,'EMP33',100,30) ;
--- to --
The "SALSUM" column of DEPT2 table have the value,
that is total of the SAL of employee in the same department.
When the EMP2 table is changed using DML,
I would like to try that the SALSUM column automatically is updated,
like method of DB trigger.
Is it possible with mapping of Hibernate3?
Would you like to advice for me.
Thank you very much.
Hibernate version: 3.1.3
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using: Oracle9i
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: