@Override protected void onBeforeUpdate(Video entity) { super.onBeforeUpdate(entity); if (entity.getVideoFile() != null) { if (entity.getVideoFile().isHasFile()) { try { saveFile(entity.getVideoFile()); } catch (Exception e) { getLogger().log(Level.SEVERE, "Error when save video file to the fileStore", e); throw new EJBException("video.error.videoFile.storefile"); } } } }