Hi,
I am working with ManyToMany annotation and I cannot obtain the behaviour I'd
like to. I need for this forum's help.
I have these tables:
SkillTypes:
id_skill_type
...
Operations:
id_operation
...
R_operations_skills:
id_r_operation_skill PK
id_operation FK
id_skill_type FK
In my 2 entity beans (I don't have a EJB for the relation table
R_operations_skills) I used these annotations:
Operation.java
@ManyToMany(cascade={CascadeType.REFRESH, CascadeType.PERSIST},
fetch=FetchType.LAZY)
| @JoinTable(name="r_operations_skills",
| [EMAIL PROTECTED](name="id_operation"),
| [EMAIL PROTECTED](name="id_skill_type"))
| @OrderBy("description")
| public List<SkillType> getSkillTypes() {
| return skillTypes;
| }
|
SkillType.java
@ManyToMany(cascade={CascadeType.REFRESH, CascadeType.PERSIST},
fetch=FetchType.LAZY)
| @JoinTable(name="r_operations_skills",
| [EMAIL PROTECTED](name="id_skill_type"),
| [EMAIL PROTECTED](name="id_operation"))
| @OrderBy("description")
| public List<Operation> getOperations() {
| if(operations == null) {
| operations = new ArrayList<Operation>();
| }
| return this.operations;
| }
My problem is that deleting a skill which has relations with operations, the
skill is removed from SkillTypes and also records in the relation table are
deleted.
I exptected that I cannot delete a skillType used in the relation.
Could you please suggest me how to solve my problem?
Thank u
Nico
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027931#4027931
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027931
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user