,您可以手動確認該消息使用TransactionManagementType.BEAN:
@MessageDriven
@TransactionManagement(TransactionManagementType.BEAN)
public class TestMDB implements MessageListener {
@Resource
UserTransaction tx;
@Override
public void onMessage(Message msg) {
String txt="";
try {
tx.begin();
TextMessage txtMsg = (TextMessage) msg;
txt = txtMsg.getText();
tx.commit();
} catch (Exception e) {
try {
tx.rollback();
} catch (Exception e1) {
//....
}
}
// call some EJB transactional method
// or
try {
tx.begin();
//do some db stuff
tx.commit();
}catch(Exception e){
//...
}
}
}
這個問題提到JDBC和SQL,但它有什麼用Microsoft Access? (「mdb」標記當前被定義爲「ms-access」的別名,並自動轉換。) – 2013-05-13 17:31:32
我的錯誤是,mdb用於消息驅動Bean。我會嘗試更新這些標籤。謝謝! – 2013-05-13 18:27:29