ADF Entities Association - Cascade Delete,Update

In this post we see how cascade delete enabled on associations. http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcentities.htm#sm0126
Section:4.10.3

we know how referential integrity works at DB level. Lets create a 2 tables emp and dep with emp having relationship with dep.

create table dep (did number not null, dname varchar2(40), modified_by varchar2(40), modified_on Date, primary key (did));

create table emp (eid number not null, ename varchar2(40), did number,primary key (eid), foreign key(did) references dep(did));

create EO/VO/Links/Association using Create Business Component wizards ( normal process we follow ). This is how it looks after completion of creating EO/VO/Links/Assocation, you can also manually create assocations later if you had missed in wizard. Double click the association, you can notice nothing is checked by default. 

casc1.PNG


 However entity Association provides below list features, lets see how it behaves before selecting and after selecting these options.

  • Implement Cascade Delete: When selected, this option allows the composing entity object to be removed unconditionally together with any composed children entities

  • Cascade Update Key Attributes : When selected, it enable the automatic update of the foreign key attribute values in composed entities when the primary key value of the composing entity is changed.

  • Locking of Composite Parent Entities : Select the Lock Top-Level Container to control whether adding, removing, or modifying a composed detail entity row should attempt to lock the composing entity before allowing the changes to be saved.

  • Updating of Composing Parent History Attributes : Select the Update Top-Level History Columns option (see Figure 4-12) to control whether adding, removing, or modifying a composed detail entity object should update the Modified By and Modified On history attributes of the composing parent entity.



casc1.PNG





 

casc2.PNG


 
casc3.PNG
casc4.PNG
with unchecked History Update on Parent entities flag, you can notice modified date does not change upon updating the record in emp table.
casc5.PNG
with unchecked Implement Cascade delete flag, you can notice deleting department record throws error.
casc6.PNG
casc7.PNG
casc8.PNG
casc9.PNG
casc10.PNG
casc11.PNG
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

bocadmin_ww

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today