我需要您的帮助,使用PostgresSQL数据库将实体映射到表,事实上,导致此错误的原因是我试图将实体映射到表,不幸的是,maven导致了我无法识别的问题,
所以我必须使用code first方法,使用jpa持久性将这个实体映射到postgresql中的表。xml和jboss wildfly。提前感谢您的支持。
package testdb;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the "HAHA" database table.
*
*/
@Entity
@Table(name="Ha_ha", schema="public")
public class Haha implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="ID_HAHA")
private long idHaha;
@Column(name="DESIGNATION")
private String designation;
public Haha() {
}
public long getIdHaha() {
return this.idHaha;
}
public void setIdHaha(long idHaha) {
this.idHaha = idHaha;
}
public String getDesignation() {
return this.designation;
}
public void setDesignation(String designation) {
this.designation = designation;
}
}
下面是一个错误消息的示例,与maven的输出完全相同:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[4,1] package javax.persistence does not exist
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[11,2] cannot find symbol
symbol: class Entity
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[12,2] cannot find symbol
symbol: class Table
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[16,10] cannot find symbol
symbol: class Id
location: class testdb.Haha
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[17,10] cannot find symbol
symbol: class Column
location: class testdb.Haha
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[20,10] cannot find symbol
symbol: class Column
location: class testdb.Haha
[INFO] 6 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.759 s
[INFO] Finished at: 2017-11-19T02:12:34+01:00
[INFO] Final Memory: 17M/211M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project testdb: Compilation failure: Compilation failure:
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[4,1] package javax.persistence does not exist
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[11,2] cannot find symbol
[ERROR] symbol: class Entity
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[12,2] cannot find symbol
[ERROR] symbol: class Table
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[16,10] cannot find symbol
[ERROR] symbol: class Id
[ERROR] location: class testdb.Haha
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[17,10] cannot find symbol
[ERROR] symbol: class Column
[ERROR] location: class testdb.Haha
[ERROR] /C:/Users/anonyme/eclipse-workspace/testdb/src/testdb/Haha.java:[20,10] cannot find symbol
[ERROR] symbol: class Column
[ERROR] location: class testdb.Haha
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException