|Cascade Remove problem [message #1061603]
||Mon, 03 June 2013 08:55
| mohamed ibrahim mohamed
Registered: April 2013
Dear Friends , |
The problem is as follows :
I am building something like content management system , Where i want to track which pages viewed by which users.
For this , i have class Called ActorEO which represent any employee and another class called PageEO which represents any viewable page and a HistoryLogEO which represents which pages viewed by which users . the mapping as follows
public class ActorEO extends EntityEO
protected List<HistoryLog> viewHistory;
public class PageEO extends ContentEO
//There are some fields related to pageEO in here
//There is no relationship with HistoryLog anyway
//Sometimes i try to add this but it cascades the delete operation to actorEO
//And deletes actorEO (Which i don't want to delete the actorEO)
protected List<HistoryLog> viewedHistory;
//History Log Class
public class HistoryLog extends EntityEO
protected ActorEO performer;
protected PageEO visitedPage;
The problem is , If i want to delete a page without putting "ViewedHistory" mapping in the pageEO , it gives me a violation of foreign keys in table History logs itself because it has a fk to the pages table .
if i tried to put ViewedHistory mapping in the pageEO , and i try to remove a page , it removes the logs and it removes the ActorEO as well which in this case is the employee , i don't want this cascade to remove the Employee.
What i want is to remove the page and any record inside the History Logs table .
How can i accomplish that in JPA Annotation or if there is any good solution for that i will really appreciate it
Thanks in advance.
[Updated on: Mon, 03 June 2013 08:55]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.86809 seconds