相关疑难解决方法(0)

为什么hibernate在MySQL中使用"select"语句后总是调用"update"语句?

在这种情况下有人帮助我吗?我正在使用hibernate从db中选择数据,但是当我从sql调试日志中检查时.我总是看到在使用"select"sql从DB获取数据后打印的更新sql.

2013-08-13 13:39:08,054 DEBUG [http-0.0.0.0-8080-1-TASK]-[org.hibernate.SQL]
SELECT this_.id                                            AS id504_2_,
    this_.bridgedlinedialoguri                          AS bridgedL2_504_2_,
    this_.bridgedlineuri                                AS bridgedL3_504_2_,
    this_.currentsipsubscriberprofile                   AS currentS4_504_2_,
    this_.currentsipsubscriberprofiletype               AS currentS5_504_2_,
    this_.messageeventuri                               AS messageE6_504_2_,
    this_.nemobjectid                                   AS neMobjec7_504_2_,
    this_.objectid                                      AS objectId504_2_,
    this_.objecttype                                    AS objectType504_2_,
    this_.sipbridgedlineurienable                       AS sipBrid10_504_2_,
    this_.sipdirectconnecturi                           AS sipDire11_504_2_,
    this_.sipdirectconnecturienable                     AS sipDire12_504_2_,
    this_.sipidentityaddress                            AS sipIden13_504_2_,
    this_.sipidentitycontacturi                         AS sipIden14_504_2_,
    this_.sipidentitypassword                           AS sipIden15_504_2_,
    this_.sipidentityrealm                              AS sipIden16_504_2_,
    this_.sipiotparametersenablestatus                  AS sipIotP17_504_2_,
    this_.sipiotparametersprivacy                       AS sipIotP18_504_2_,
    this_.sipiotparametersrequire100rel                 AS sipIotP19_504_2_,
    this_.sipiotparameterssupport100rel                 AS sipIotP20_504_2_,
    this_.sipmessageeventurienable                      AS sipMess21_504_2_,
    this_.sippreferredid                                AS sipPref22_504_2_,
    this_.sippreferredidmode                            AS sipPref23_504_2_,
    this_.sipsubscribertemplateenable                   AS sipSubs24_504_2_,
    this_.sipusername                                   AS …
Run Code Online (Sandbox Code Playgroud)

java sql database hibernate jpa

11
推荐指数
1
解决办法
1万
查看次数

SqlServer 2005:没有共享记录的死锁问题

我有两个不访问任何常见记录的事务的死锁问题.也没有锁升级.所以我无法解释为什么死锁是可能的.

当两个此类事务同时执行时发生死锁:

begin transaction

update A set [value] = [value]
where id = 1; /* resp. 2 */

/* synchronize transactions here */

SELECT * 
FROM  
 A inner join B on A.B_FK = B.id
 inner join C on C.A_FK = A.id
WHERE 
 A.[value] = 1; /* resp. 2 */

rollback;
Run Code Online (Sandbox Code Playgroud)

这些是用于设置场景的表和数据:

CREATE TABLE A (
  id INT NOT NULL,
  [value] INT,
  B_FK INT
  primary key (id)
)

CREATE TABLE B (
  id INT NOT NULL,
  primary key (id)
)

CREATE …
Run Code Online (Sandbox Code Playgroud)

deadlock sql-server-2005

5
推荐指数
1
解决办法
3838
查看次数

SQL从表中选择行并更新相同的行

我想要 :

  1. 从表中选择N行以进行处理,其中flag = 0
  2. 使用来自这N行的值在第二个表上进行一些工作
  3. 更新这N行并设置flag = 1

我有并行进程一起完成同样的工作,我想确保所有人都能在独特的行上工作.我该如何确保?

sql database sql-server sql-server-2005 sql-server-2008

5
推荐指数
1
解决办法
3554
查看次数

Oracle中的并发性比SQL Server更好?

是否可以在Oracle数据库中实现比在MS SQL Server数据库中更好的并发?特别是在OLTP场景中,例如ERP系统?

我无意中听到SAP顾问提出这种说法,指的是Oracle锁定技术,如行锁定和多版本读取一致性以及重做日志.

sql-server oracle

4
推荐指数
2
解决办法
4701
查看次数

从存储库中选择内容,其中 id = ? 用于更新

上述查询在 Oracle 10g 上成功运行。现在我必须使用 SQLSERVER 2005 实现相同的查询(应用程序)。

当我在 SQLSERVER 2005 中运行上述查询时,出现错误“FOR UPDATE 子句仅允许用于 DECLARE CURSOR”。

SQLSERVER 2005 支持上述查询吗?或者有什么替代方案吗?

目的:

基本上我正在更新我的应用程序中的文档。我正在使用分块更新,每次都必须将旧内容附加到新内容。

代码:

Blob bb = getDataAccess().executeScalar( "select content from Repository where id = ? for update", getId());
os = bb.setBinaryStream(startIndex + 1);

while ((read = content.read(buf)) > 0) {
    os.write(buf, 0, read);
    startIndex += read;

    //commit every megabate or every second so upload progress is visible
    //and we don't lose more than 1MB if something happens.

    if (startIndex - lastStartIndex > …
Run Code Online (Sandbox Code Playgroud)

java sql sql-server-2005 jdbc oracle10g

0
推荐指数
1
解决办法
2302
查看次数