【发布时间】:2016-11-17 17:10:54
【问题描述】:
我使用 EMF 在 Java 中构建应用程序。
我使用 Java8 JDK。
我所需要的只是持久化我的模型类的实例。
我从 Eclipse 远程在 WildFly 10 服务器上以调试模式运行代码。
private String getXml(Audit audit) throws NeoflexException {
XMLResource res = new XMLResourceImpl();
res.getContents().add(audit);
StringWriter sw = new StringWriter();
try {
res.save(sw, null);
} catch (IOException e) {
throw new NeoflexException(e);
}
return sw.toString();
}
在序列化时,我得到一个NotSerializableException。
我看到生成的审计类没有标记为Serializable。
我无法编辑生成的代码,但是,我也没有选项将图表中的此类标记为可序列化。
如此处所述:https://www.eclipse.org/forums/index.php/t/261475/
我需要创建一个接口并从可序列化中派生它,但我没有这样的选项。请参阅随附的屏幕截图。
【问题讨论】: