错误信息:
No default constructor for entity: org.tongda.busonline.schedule.domain.DhMdispatchcommandExt
【原因】
The no-argument constructor, which is also a JavaBean convention, is a requirement for all persistent classes. Hibernate needs to create objects for you, using Java Reflection.
所有持久化类必须要求有不带参的构造方法(也是JavaBean的规范)。Hibernate需要使用Java反射为你创建对象。
——来自官方文档《Hibernate Getting Started Guide》
【解决方法】
当实体类声明了其他带参构造方法时,需要显式声明不带参构造方法。
/*空构造*/
public DhMdispatchcommandExt() {
}
/*有参构造*/
public DhMdispatchcommandExt(Long id, Long sendTimeScope) {
this.commandId = id;
this.sendTimeScope = sendTimeScope;
}