Postgresql has a nifty feature "ON UPDATE CASCADE", which allows me to update the value for a Primary Key in the Parent table, and the Child tables will automatically be updated. Is this supported in any way in Hibernate?
For example, in Postgresql:
create table tParent (pKey varchar(16) primary key, f1 int, f2 int);
create table tChild (f1 int, f2 int, fKey varchar (16) references tParent ON UPDATE CASCADE);
insert into tParent values ('OldPkeyValue', 1, 1);
insert into tChild values (2, 2, 'OldPkeyValue');
update tParent set pKey = 'NewPkeyValue' where pKey = 'OldPkeyValue';
This automatically updates tChild to reflect the new value.
I have the need to do the same thing in my Application. I have a primary key (userId) which generally will contain a User's email address. If their address changes, I need to update it. Does anyone know how to do this effectively with Hibernate?