Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java NetBeans平台两次捕获一个异常_Java_Hibernate_Netbeans_Platform - Fatal编程技术网

Java NetBeans平台两次捕获一个异常

Java NetBeans平台两次捕获一个异常,java,hibernate,netbeans,platform,Java,Hibernate,Netbeans,Platform,您好,我是使用Netbeans平台开发和应用程序的,我无法捕获此异常: org.hibernate.exception.ConstraintViolationException 我使用以下行: try { il.delete(lote); } catch (HibernateException he) { NotifyDescriptor error = new NotifyDescriptor.Messa

您好,我是使用Netbeans平台开发和应用程序的,我无法捕获此异常:

org.hibernate.exception.ConstraintViolationException

我使用以下行:

       try { 
           il.delete(lote);

       }
       catch (HibernateException he) {
           NotifyDescriptor error = new NotifyDescriptor.Message(ERROR+he.getMessage(), NotifyDescriptor.ERROR_MESSAGE);
           DialogDisplayer.getDefault().notify(error);
       }
我的接口可能会抛出此异常,并且可以在TopComponent中捕获该异常。问题是我收到两次,一次是我的通知,另一次是来自平台。 我怎样才能解决这个问题


如果出现上述代码,您不可能收到两次异常。因为只有一个方法调用返回异常。 可能的情况是,您可能会请求它两次,以便多次收到异常


您可以做的是添加一个日志检查,如果在单击时多次调用该方法,并修复该问题。

在上述代码的情况下,您不可能两次收到异常。因为只有一个方法调用返回异常。 可能的情况是,您可能会请求它两次,以便多次收到异常


您可以做的是添加一个日志检查,如果方法在单击时被多次调用,则修复该问题。

很遗憾,我无法上载图像,但收到的通知不同,一个是DialogDisplayer mia,另一个是本机平台,从netbeans导出jar文件并从外部执行代码此行为可能特定于netbeans。不幸的是,我无法上载映像,但收到的通知不同,一个是DialogDisplayer mia,另一个是本机平台,从netbeans导出jar文件并从外部执行代码。此行为可能特定于netbeans。