首页 \ 问答 \ 使用alter table的Spring Jdbc原子性(Spring Jdbc atomicity with alter table)

使用alter table的Spring Jdbc原子性(Spring Jdbc atomicity with alter table)

我正在尝试使用Spring Jdbc编写等效的Rails数据模型演化/回滚机制。

Spring Jdbc transactionnal insert/replace工作得很好(在InnoDB mysql 5下使用PROPAGATION_REQUIRED的DataSourceTransactionManager):

// Transaction begins
getJdbcTemplate().execute("replace into aTable ...");
getJdbcTemplate().execute("wrong request");
getJdbcTemplate().execute("replace into aTable ...");
// none are commited

alter不是:

// Transaction begins
getJdbcTemplate().execute("alter table aTable add column `columnForTest` ...");
getJdbcTemplate().execute("wrong request");
getJdbcTemplate().execute("alter table aTable add column `columnForTest` ...");
// the first alter is commited

有没有办法用alter实现原子性(全有或全无行为)?

提前致谢


I'm trying to write an equivalent of Rails data model evolution/rollback mechanism using Spring Jdbc.

Spring Jdbc transactionnal insert/replace works very well (DataSourceTransactionManager with PROPAGATION_REQUIRED under InnoDB mysql 5) :

// Transaction begins
getJdbcTemplate().execute("replace into aTable ...");
getJdbcTemplate().execute("wrong request");
getJdbcTemplate().execute("replace into aTable ...");
// none are commited

but alter doesn't :

// Transaction begins
getJdbcTemplate().execute("alter table aTable add column `columnForTest` ...");
getJdbcTemplate().execute("wrong request");
getJdbcTemplate().execute("alter table aTable add column `columnForTest` ...");
// the first alter is commited

Is there a way to achieve atomicity (all-or-none behavior) with alter ?

Thanks in advance


原文:https://stackoverflow.com/questions/3238918
更新时间:2023-05-19 10:05

最满意答案

app id和app unit id应该不同。 在你的代码中似乎是一样的

这里是完整的官方说明: https//firebase.google.com/docs/admob/android/quick-start


app id and app unit id should be different. in your code seems to be same

here is full official description: https://firebase.google.com/docs/admob/android/quick-start

相关问答

更多
  • errorcode301,直接翻译就是"错误代码301", 因为我不玩这游戏所以你只能自己联系下管理员或什么的,告诉他错误代码就是301,对方就会告诉你到底错误细节是啥了
  • 我解决了问题,问题是因为我在使用google-play-services_lib时尝试添加GoogleAdMobAdsSdk-6.4.1.jar我完成了这个链接中的内容 ,它现在可以正常工作了 I Solved it, The Problem was because I was trying to add GoogleAdMobAdsSdk-6.4.1.jar while using google-play-services_lib I done like what in this link and it ...
  • 它刚开始工作,我什么都没变。 也许之前构建它有问题吗? 谁知道,感谢所有帮助,虽然家伙。 It just started working, I changed nothing. Maybe there was a problem building it before? Who knows, thanks for all the help though guys.
  • 等待几个小时,你就会开始收到广告。 如果它是新创建的广告单元ID,则服务器需要一段时间才能在所有实例上进行复制(也称为预热广告单元)。 如果它与添加的测试设备ID一起工作,它将在没有测试设备ID的情况下正常工作。 Just wait for a few hours and you'll start getting the ads. If it is a newly created ad unit id it will take some time for the servers to replicate i ...
  • 克服这个障碍的最小努力将是一个静态帮助器/实用程序方法,它使用反射来破解所需错误代码中的插槽。 使用最优秀的Reflector,我看到有一个私有的“errorCode”字段,它只能通过ManagementException中定义的内部ctors设置。 所以:) public static class EncapsulationBreaker { public static ManagementException GetManagementExceptionWithSpecificError ...
  • 这个问题是关于安装在我的手机上的自定义ROM。 所以,在代码中没有错误。 Thansk的帮助,并希望这可能有助于未来的人。 The issue was about adaway installed on my phone with a custom rom. So, no error in the code. Thansk for helping, and hope this can be helpful for someone in future.
  • 是的,它们完全一样。 看一下源代码 : public override int ErrorCode { // // the base class returns the HResult with this property // we need the Win32 Error Code, hence the override. // get { return NativeErrorCode; } } public SocketError So ...
  • 不得不改为accountNumber: 1111111, 好的,payex的节点解决方案,如果有人想要/需要它然后:) Had to change to accountNumber: 1111111, Ok, node solution for payex if anyone wants/needs it then :)
  • 在IBM页面上搜索错误: http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z10.doc.java%2Fsrc%2Ftpc%2Fimjcc_rjvjcsqc.htm - 4229消息文本:text-from-getMessage说明:批处理执行期间发生错误。 用户响应:调用SQLException.getMessage以检索有关该问题的特定信息。 因此,它可能与执行批量插入/更新/删除期 ...
  • app id和app unit id应该不同。 在你的代码中似乎是一样的 这里是完整的官方说明: https : //firebase.google.com/docs/admob/android/quick-start app id and app unit id should be different. in your code seems to be same here is full official description: https://firebase.google.com/docs/admo ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。