@Transactional
public boolean addPersonToDb(Person p) { // message on this line
//some logic
}
代碼編譯,並沒有任何問題運行。
消息本身:在該行多個標記
- 實現
com.pname1.pname2.pname3.pname4.PersonDAO.addPersonToDb
- 通過
org.springframework.transaction。 interceptor.TransactionInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)
我真的不明白,如果它是一個錯誤或只是一個消息,看着其他線程人們把它當作一個錯誤。我只是擔心我的交易是否有效。
好吧,類實現接口和它的方法註釋爲事務性的,有什麼不對嗎?
更新:解決了一些小錯誤,Web應用程序的作品,但我仍然得到這一信息(而不是在堆棧跟蹤,但上線斷點):由 org.springframework.transaction.interceptor建議
.TransactionInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)
現狀:
@Transactional
public void registerNewUser(Person p) { // this gives message on line breakpoint - advised by ...; AND this method is implemented by interface
pd.addPersonToDb(p);
}
@Transactional
public void blabla(Person p){ // this does not, as expected; AND it is not in interface
}
我的交易是否有效? (我有沒有異常和運行Web應用程序和方法的工作)
我不明白,如果這條消息的錯誤或不?
這是可以的。使一個方法實現事務性,即使實現的方法本身不是事務性的。這意味着問題在於別處。你能粘貼完整的堆棧跟蹤嗎? – ruhsuzbaykus
請參閱更新的答案 – Aubergine