Jpa 此类未定义公共默认构造函数,或者构造函数引发了异常。内部异常:java.lang.InstanceionException
大家好,我有我的JPA项目的问题。 java实现了一个接口“FileSystemElement.java” 那些是我的课 Application.javaJpa 此类未定义公共默认构造函数,或者构造函数引发了异常。内部异常:java.lang.InstanceionException,jpa,eclipselink,Jpa,Eclipselink,大家好,我有我的JPA项目的问题。 java实现了一个接口“FileSystemElement.java” 那些是我的课 Application.java package com.bfi.webtop.model; import java.io.Serializable; import java.util.*; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.pe
package com.bfi.webtop.model;
import java.io.Serializable;
import java.util.*;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
/** @pdOid d477195f-149e-4336-8586-19d6a09ee2d4 */
@Entity
@Table(name="application_")
public abstract class Application implements FileSystemElement, Serializable {
// public Application() {
// super();
// }
public Application(int id_app, String url) {
super();
this.id_app = id_app;
this.url = url;
}
public Application() {
super();
// TODO Auto-generated constructor stub
}
private int id_app;
private java.lang.String url;
/**
* @return the url
*/
public java.lang.String getUrl() {
return url;
}
/**
* @param url the url to set
*/
public void setUrl(java.lang.String url) {
this.url = url;
}
/**
* @return the id_app
*/
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getId_app() {
return id_app;
}
/**
* @param id_app the id_app to set
*/
public void setId_app(int id_app) {
this.id_app = id_app;
}
}
java
package com.bfi.webtop.model;
/***********************************************************************
* Module: Fichier.java
* Author: Marwa
* Purpose: Defines the Class Fichier
***********************************************************************/
import java.util.*;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public abstract class Fichier implements FileSystemElement {
private int id_fichier;
private java.lang.String extension;
private java.lang.Boolean supprim;
/**
* @return the extension
*/
public java.lang.String getExtension() {
return extension;
}
/**
* @param extension the extension to set
*/
public void setExtension(java.lang.String extension) {
this.extension = extension;
}
/**
* @return the supprim
*/
public java.lang.Boolean getSupprim() {
return supprim;
}
/**
* @param supprim the supprim to set
*/
public void setSupprim(java.lang.Boolean supprim) {
this.supprim = supprim;
}
/**
* @return the id_fichier
*/
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getId_fichier() {
return id_fichier;
}
/**
* @param id_fichier the id_fichier to set
*/
public void setId_fichier(int id_fichier) {
this.id_fichier = id_fichier;
}
public Fichier() {
super();
}
}
FileSystemElement.java
package com.bfi.webtop.model;
import javax.annotation.Generated;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2013-01-28T10:33:26.416+0100")
@StaticMetamodel(FileSystemElement.class)
public class FileSystemElement_ {
}
其他类具有相同的结构
当我尝试这样做:jpa tooles>从实体生成表时,我有以下错误
线程“main”javax.persistence.PersistenceException:Exception>[EclipseLink-28019](Eclipse持久性服务-2.4.0.v20120608-r11652):org.Eclipse.persistence.exceptions.EntityManagerSetupException
异常描述:PersistenceUnit[webtop]的部署失败。关闭此PersistenceUnit的所有工厂。
内部异常:异常[EclipseLink-0](Eclipse持久性服务-2.4.0.v20120608-r11652):org.Eclipse.Persistence.exceptions.IntegrityException
描述符异常:
异常[EclipseLink-34](Eclipse持久性服务-2.4.0.v20120608-r11652):org.Eclipse.Persistence.exceptions.DescriptorException
异常描述:此类未定义公共默认构造函数,或者构造函数引发异常。
内部异常:java.lang.InstanceionException
描述符:RelationalDescriptor(com.bfi.webtop.model.Application-->[数据库表(应用程序)])
异常[EclipseLink-34](Eclipse持久性服务-2.4.0.v20120608-r11652):org.Eclipse.Persistence.exceptions.DescriptorException
异常描述:此类未定义公共默认构造函数,或者构造函数引发异常。
内部异常:java.lang.InstanceionException
描述符:RelationalDescriptor(com.bfi.webtop.model.Fichier-->[DatabaseTable(Fichier)])
异常[EclipseLink-34](Eclipse持久性服务-2.4.0.v20120608-r11652):org.Eclipse.Persistence.exceptions.DescriptorException
异常描述:此类未定义公共默认构造函数,或者构造函数引发异常。
内部异常:java.lang.InstanceionException
描述符:RelationalDescriptor(com.bfi.webtop.model.Raccourci-->[DatabaseTable(Raccourci)])
运行时异常:
异常描述:PersistenceUnit[webtop]的部署失败。关闭此PersistenceUnit的所有工厂。
内部异常:异常[EclipseLink-0](Eclipse持久性服务-2.4.0.v20120608-r11652):org.Eclipse.Persistence.exceptions.IntegrityException
我正在使用EclipseJuno
需要帮忙吗
}正如错误所述,您需要为应用程序类提供默认(无参数)构造函数
如果不想将构造函数公开给应用程序,则该构造函数可以是私有的。如错误所述,您需要为应用程序类提供默认(无参数)构造函数
如果您不想将构造函数公开给应用程序,则构造函数可以是私有的。您已将类Fichier定义为抽象类:
public abstract class Fichier
删除抽象,它就会工作。本例中的错误消息有些混乱。您已将类Fichier定义为抽象:
public abstract class Fichier
删除抽象,它就会工作。本例中的错误消息有些混乱。考虑在类中不创建arg构造函数,然后清理项目并重试。
我也有同样的问题,我使用lombok修复了它考虑在类中不创建arg构造函数,然后清理项目并尝试。
我也遇到了同样的问题,我使用lombok修复了它为什么要注释掉默认的无参数应用程序构造函数?错误状态EclipseLink无法启动类的新实例,因此它可能是相关的。
FileSystemElement
接口在哪里?我只看到一个FileSystemElement\uuu
类。为什么Application
和Fichier
类是抽象的?为什么要注释掉默认的无参数应用程序构造函数?错误状态EclipseLink无法启动类的新实例,因此它可能是相关的。FileSystemElement
接口在哪里?我只看到一个文件系统元素
类。为什么应用程序
和Fichier
类是抽象的?这并没有改变任何事情,jamest构造函数不应该是私有的,因为它违反了JPA2规范,该规范规定:实体类必须有一个无参数构造函数。实体类也可以有其他构造函数。无参数构造函数必须是公共的或受保护的
,这不会改变任何东西Jamest构造函数不应该是私有的,因为它违反了JPA2规范,该规范规定:实体类必须有无参数构造函数。实体类也可以有其他构造函数。无参数构造函数必须是公共的或受保护的