Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如果我的构造函数中有这个:
public class Foo { private final String param1; private final String param2; foo() { this.param1 = "param1"; } }
现在我想知道,如果我从数据库中检索对象,那么是否调用了相同的构造函数,或者它只在第一次发生
是的,Hibernate 为它创建和填充的每个实体实例调用无参数构造函数。不过,您上面的代码不是 Java 代码。