[英]Why does JPA require a no-arg constructor for domain objects?
为什么 JPA 需要域对象的无参数构造函数? 我正在使用 eclipselink 并且在部署过程中遇到了这个异常。
Exception [EclipseLink-63] (Eclipse Persistence Services-1.1.0.r3639-SNAPSHOT):
org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The instance creation method
[com.me.model.UserVO.<Default Constructor>], with no parameters,
does not exist, or is not accessible.
Internal Exception: java.lang.NoSuchMethodException:
com.me.model.UserVO.<init>()
Descriptor: RelationalDescriptor(com.me.model.UserVO -->
[DatabaseTable(user)])
因为经常发生 JPA 提供者必须动态实例化您的域对象的情况。 它不能这样做,除非有一个无参数构造函数——它无法猜测参数应该是什么。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.