简体   繁体   English

ibatis插入DB2表会导致锁定,导致触发器无法正常工作

[英]ibatis insert into a DB2 table results in a lock that prevents a trigger working

I am writing an INSERT into a DB2 table that uses my inserted record as a trigger and have been accused of being the culprit for locking the file and preventing the trigger from working. 我正在将INSERT写入使用我插入的记录作为触发器的DB2表中,并且被指控是锁定文件并阻止触发器起作用的罪魁祸首。

Currently I can write the record but it hangs my application and I get no response back from the DB2 database. 当前,我可以写记录,但是它会挂起我的应用程序,并且没有从DB2数据库返回任何响应。 (although it does write !). (尽管它确实写!)。

I have been told I might be writing using "UPDATE mode" but I have done nothing specific other than not actually setting any mode: 有人告诉我我可能正在使用“更新模式”进行编写,但是除了没有实际设置任何模式外,我没有做任何其他特定的事情:

  <resultMap id = "insertEntry" class = "customer">
        <result property = "supplierNumber"     column = "SUPN"/>
        <result property = "status"          column = "STAT"/>
        <result property = "timeAccepted"   column = "TIMEACC"/>
        <result property = "dateAccepted"   column = "DATEACC"/>
        <result property = "dateCompleted"   column = "DATECOMP"/>
    </resultMap>


<insert id = "insertCUSTRecord" parameterClass="insertEntry">
INSERT INTO ##AKQQ3
(SUPN, STAT, TIMEACC, DATEACC, DATECOMP)
VALUES (#supplierNumber#, #status#, #timeAccepted#, #dateAccepted#, #dateCompleted#)
</insert>

I can only guess at the cause of my application hanging and one guess is that is a result of not having set the relevant mode on an an INSERT statement but I have no idea as to which is relevant from a choice of ibatis' IN, OUT and INOUT parameters. 我只能猜测我的应用程序挂起的原因,一个猜测是没有在INSERT语句上设置相关模式的结果,但是我不知道从ibatis的IN,OUT中选择哪个相关和INOUT参数。

The RPG team have told me to attempt to somehow try and read the record I have just inserted to release this lock and was wondering if any of these ibatis modes provides that functionality. RPG团队告诉我尝试以某种方式尝试阅读我刚刚插入的记录以释放此锁,并且想知道这些ibatis模式中的任何一种是否提供该功能。

The docs state "If a parameter is OUT or INOUT, the actual value of the parameter object property will be changed" but I'm somewhat confused as to what object this refers to. docs声明“如果参数为OUT或INOUT,则参数对象属性的实际值将被更改”,但是我对它所指的对象有些困惑。 Could setting all my insert values to IN be what I'm looking for ? 我可以将所有插入值设置为IN吗?

I should mention that I have used the Squirrel SQL client to attempt the same insert (using the jt400 JDBC driver) and it hangs and get no confirmation back from the database despite having written the record. 我应该提到的是,我已经使用Squirrel SQL客户端尝试了相同的插入操作(使用jt400 JDBC驱动程序),尽管写入了记录,但它仍然挂起并且没有从数据库返回确认。

In my application I have resorted to a "fire and forget" approach of dealing with not having a response back from the DB2 database via an ExecutorService that I kill after 3 seconds although I know this is not an ideal solution. 在我的应用程序中,我采用了一种“即发即弃”的方法来处理没有通过ExecutorService从DB2数据库返回响应的问题,尽管我知道这不是理想的解决方案,但是我在三秒钟后就将其杀死了。

My program integrates struts with spring and ibatis, the code that calls the insert is as follows: 我的程序将struts与spring和ibatis集成在一起,调用insert的代码如下:

public void insertIntoAKQA(CustomerTriggerDetailsBean customerTriggerDetails) {
    SqlMapClientTemplate template = getSqlMapClientTemplate();
    template.insert("insertCUSTRecord", customerTriggerDetails);
}

The problem turned out to be an RPG trigger which was badly written. 问题原来是一个RPG触发器,写得不好。 Until they resolved it I did however manage a workaround with the Java ServiceExecutor which gave me back control of my application after an assigned time. 在他们解决之前,我确实使用Java ServiceExecutor管理了一种变通方法,该方法可以在指定的时间后让我对应用程序进行控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM