目前,我正在使用Spring 4.0.6和Postgresql 9.5。我打電話一個serviceClass1
到另一個serviceClass2
,卻得到了異常的交易如下:在這個地方Spring和Postgres事務錯誤
serviceClass1.class
`@Transactional(readOnly = false, propagation = Propagation.REQUIRED,rollbackFor= { Throwable.class })
public Map<String, Object> storeUsersList(Map<String, Object> mapOfParams) throws Exception {
Map<String, Object> returnMap = new HashMap<String, Object>();
if (userListToStore != null && !userListToStore.isEmpty()) {
integrationService.manangePassCodes(org,userListToStore.size());
for (Users singleUser : userListToStore) {
try {
getEm().update(singleUser);`
serviceClass2.class
@Override
@Transactional(readOnly=false,propagation=Propagation.REQUIRED
,rollbackFor{Throwable.class})
public void manangePassCodes(Organizations org,int userToRegisterCount)throws Exception{
//some Logic
在這裏我得到異常 - getEm().update(singleUser);
異常SQL狀態[25P02];錯誤代碼[0];不能提取 的ResultSet
剛纔我看到有關此錯誤的Postgres左右交易,但沒能得到我應該怎麼使用Hibernate的。
感謝,但我已經通過檢查越來越閱讀有關此錯誤消息解決了我的問題,我的結論是,保存錯誤不在'getEm()。update(singleUser);' – ThinkTank
對於現有評論感到抱歉。 謝謝,但我通過檢查更多並閱讀上述錯誤消息解決了我的問題。 這意味着先前的事務被中止接下來無法繼續保存錯誤不在'getEm()。update(singleUser);' ,而它在'integrationService.manangePassCodes(org,userListToStore。size());'一段代碼 參考鏈接1 - https://www.postgresql.org/message-id/[email protected] 參考鏈接2 - https://www.postgresql .ORG /文檔/ 9.4 /靜態/ errcodes-appendix.html – ThinkTank