PropertyAccessor和PropertyAccessorFactory是删除还是已弃用?

sal*_*lee 2 orm hibernate

在问题29980421中,我发现答案中的代码示例包括PropertyAccessor和PropertyAccessorFactory.当我检查hibernate-orm项目时,我发现这些类已被删除:

org.hibernate.property.PropertyAccessor在2015-06-04 15:12:17 GMT-04:00 org.hibernate.property.PropertyAccessorFactory在2015-06-04 15:12:17 GMT-04:00删除

有人会对此提出任何反馈意见吗?

如果可能,您是否会提供一个运行示例,替换问题29980421中第一个答案中的代码示例? 如何使用Hibernate检索一组成员对象?

编辑:

感谢您的评论.阅读评论后,我从问题中删除了hibernate 4.x. PropertyAccessorFactory怎么样?

Mar*_*iel 6

也许为时已晚,但现在你必须选择PropertyAccessStrategy实现之一,像PropertyAccessStrategyFieldImpl.

    PropertyAccessStrategy accessor = PropertyAccessStrategyFieldImpl.INSTANCE;
    PropertyAccess access = accessor.buildPropertyAccess(entityClass, "propertyName");
Run Code Online (Sandbox Code Playgroud)