4
回答
事务提交问题
终于搞明白,存储TCO原来是这样算的>>>   

09 十一月 2010 15:16:55,250 [DEBUG] org.logicalcobwebs.proxool.aoke_cgms {AbstractProxyStatement.java:185} - delete from CGMS_SYS_NODE2ROLE where roleId = 34 and nodeId = 21;  (0 milliseconds)
09 十一月 2010 15:16:55,250 [DEBUG] org.logicalcobwebs.proxool.aoke_cgms {AbstractProxyStatement.java:185} - insert into CGMS_SYS_NODE2ROLE values(34,21,'1,');  (0 milliseconds)
09 十一月 2010 15:16:55,281 [DEBUG] org.logicalcobwebs.proxool.aoke_cgms {AbstractProxyStatement.java:185} - insert into CGMS_SYS_NODE2ROLE values(34,1,'1,');  (0 milliseconds)
09 十一月 2010 15:16:55,281 [DEBUG] org.logicalcobwebs.proxool.aoke_cgms {AbstractProxyStatement.java:185} - insert into CGMS_SYS_NODE2ROLE values(34,22,'1');  (0 milliseconds, threw a java.sql.SQLException: ORA-00001: 违反唯一约束条件 (AOKE_CGMS.PK_CGMS_SYS_NODE2ROLE)
)
java.sql.SQLException: ORA-00001: 违反唯一约束条件 (AOKE_CGMS.PK_CGMS_SYS_NODE2ROLE)

 

这四条语句在一个事务中,第一个删除,后三个添加。这种问题怎么解决。

/*==============================================================*/
/* Table: CGMS_SYS_NODE2ROLE                                    */
/*==============================================================*/
create table CGMS_SYS_NODE2ROLE  (
   ROLEID               NUMBER(7)                       not null,
   NODEID               NUMBER(7)                       not null,
   FUNCTIONS            VARCHAR2(500)                   not null,
   constraint PK_CGMS_SYS_NODE2ROLE primary key (ROLEID, NODEID)
);

alter table CGMS_SYS_NODE2ROLE
   add constraint FK_CGMS_SYS_NR_N foreign key (NODEID)
      references CGMS_SYS_NODE (NODEID);

alter table CGMS_SYS_NODE2ROLE
   add constraint FK_CGMS_SYS_NR_R foreign key (ROLEID)
      references CGMS_SYS_ROLE (ROLEID);

举报
顶部