我们最近将代码库从2005版本升级到最新版本的hibernate。
因此,我们看到许多软件包的代码覆盖率显着降低。 这些包几乎完全是映射到hibernate对象的POJO,差异似乎在于getter和setter的覆盖范围。 大多数这些对象都不是直接进行单元测试的,所以之前的覆盖范围大多来自于它们在某些集成测试中的使用,导致hibernate击中这些getter和setter。
有没有人见过类似的事情? hibernate填充那些可以解释这些对象的方式有没有改变?
大多数字段都设置为lazy = false,因此这可能是不可能的。
我们正在使用testng,cobertura和jdk 1.6。
We have recently upgraded our code base from a 2005 version to the latest version of hibernate.
As a result of that, we're seeing significantly reduced code coverage in a number of our packages. These packages are almost entirely POJOs mapped to hibernate objects, and the difference seems to be in the coverage of getters and setters. Most of these objects are not directly unit tested, so the previous coverage most have come from their usage in some integration test causing hibernate to hit these getters and setters.
Has anyone seen similar things happening? Has there been a change in the way hibernate populates those objects that could explain that?
Most of the fields are set to lazy=false so that's probably out of question.
We are using testng, cobertura and jdk 1.6.
最满意答案
有人改变了xml中的某些内容来改变对字段的访问,例如
<property name="xxx" ... access="field"/>还是像这样全球?
<hibernate-mapping ... default-access="field">默认情况下,hibernate的访问权限设置为property,因此应该使用提供它们的访问器。
Has somebody changed something in the xml to change the access to field, e.g.
<property name="xxx" ... access="field"/>or globally like this?
<hibernate-mapping ... default-access="field">By default hibernate's access is set to property, so that should use accessors where they are provided.
更多推荐
发布评论