我想通過應用程序插入一些值在表中,並得到問題ORA-00001:違反唯一約束。 我看到序列與表的最高ID不同步,但即使在修復序列號後,錯誤仍然存在。 我怎樣才能更多地調試這個錯誤,oracle日誌會給出更多錯誤?我怎樣才能看到oracle日誌? 感謝 Priyank問題ORA-00001:違反唯一約束進來INSERT/UPDATE
更新:我們正在使用的審計日誌插件,並在域類的用戶,我們趕上保存事件和登錄用戶類進入審計日誌
所以我們做的事:
class User {
//some attributes, constraints, mappings
def onSave = {
Graaudit aInstance = new Graaudit();
aInstance.eventType= "GRA User Create"
aInstance.eventDescription = "GRA User Created"
aInstance.objectid = username
aInstance.objecttype = 'GRAUSER'
aInstance.user_id = RequestContextHolder.currentRequestAttributes().session.username
aInstance.withTransaction{
aInstance.save()
}
}
}
當我們在onSave事件中沒有上述代碼時,用戶被成功創建。
我假設它與我們在aInstance上使用的hibernate事務相關,那是因爲保存而死亡或當前事務正在死亡。
如果我們不使用的交易,我們得到一個異常"org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here"
不知道如何解決這個問題.. 感謝
序列是唯一約束還是其他? – thursdaysgeek 2012-03-13 17:58:33