[jboss-user] [EJB 3.0] - Disable unique constraint
K@sperl
do-not-reply at jboss.com
Tue Mar 20 04:43:47 EDT 2007
Hello,
I need do disable an unique constraints for the time of an update.
Consider the following example:
@Entity
| @Table(uniqueConstraints = @UniqueConstraint(columnNames = { "personID", "fieldID" }))
| public class SomeMappingTable {
| private Integer personID;
| private Integer fieldID;
| // ...
| }
Ok, assume I have to entries in it
fieldID: 1 ("Mathematics")
| fieldID: 2 ("English")
The user has 2 combos: in the first Mathematics is selected, in the second one English.
Now, if the users switches the values (Mathematics -> English and English -> Mathematics) the unique constraint is violated because after the first update the table would contain English twice.
So, the only way how to solve the problem is to disable the unique constraint for the time of the update. Maybe somebody knows another solution.
Thanks a lot,
Kasperl
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029655#4029655
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029655
More information about the jboss-user
mailing list