1

使用休眠 3,我能够使用与 EntityMode.DOM4J 的会话导出 xml 数据:

Session session = sessionFactory.getCurrentSession();
org.hibernate.Session dom4jSession = session.getSession(EntityMode.DOM4J);
...

今天我尝试了hibernate 4。包org.hibernate.classic是空的,EntityMode中没有DOM4J了。我还尝试将属性“hibernate.default_entity_mode”设置为“dom4j”,但这指的是与上面相同的错误(原因:java.lang.IllegalArgumentException:没有枚举常量类 org.hibernate.EntityMode.DOM4J)。

是否仍然可以在休眠 4 中使用 dom4j xml 序列化?还是我错过了其他东西?

谢谢你

4

1 回答 1

0

That feature was always experimental and has been removed. I would like to get back to allowing such a thing, but it will more be allowing "marshallers" to be passed in. If you feel like working on that, contact the dev team on the hibernate-dev mailing list.

this feature was removed in hibernate 4. sadly, the documentation of hibernate 4 still describes this feature the way it was in hibernate 4.

is there an other way to have jpa and xml export/import without using additional jaxb annotations? maybe eclipselink has such a feature?

于 2012-06-06T07:59:22.687 回答