Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 未创建实体中的数据库表_Java_Oracle_Jpa_Netbeans_Glassfish - Fatal编程技术网

Java 未创建实体中的数据库表

Java 未创建实体中的数据库表,java,oracle,jpa,netbeans,glassfish,Java,Oracle,Jpa,Netbeans,Glassfish,我在netbeans中创建了一个新的maven web应用程序。我编写了两个实体类,如下所示: @Entity public class Employee { public enum Role { ADMIN,USER;} @Version private int version; @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @Column(nullable = false, unique =

我在netbeans中创建了一个新的maven web应用程序。我编写了两个实体类,如下所示:

@Entity
public class Employee {

public enum Role { ADMIN,USER;}

@Version
private int version;

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;

@Column(nullable = false, unique = true)
private String username;

private String password;
private String fullName;
private Role role;

@ManyToMany
private List<Project> projects;

@OneToMany(cascade = CascadeType.ALL, mappedBy = "employee")
private List<Task> tasks;

@ManyToMany
private List<Meeting> meetings;

public void setRoleFromString(String stringRole){
    role = Role.valueOf(stringRole);
}

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    Employee other = (Employee) obj;
    if (fullName == null) {
        if (other.fullName != null)
            return false;
    } else if (!fullName.equals(other.fullName))
        return false;
    if (id != other.id)
        return false;
    if (password == null) {
        if (other.password != null)
            return false;
    } else if (!password.equals(other.password))
        return false;
    if (role != other.role)
        return false;
    if (username == null) {
        if (other.username != null)
            return false;
    } else if (!username.equals(other.username))
        return false;
    return true;
}

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((fullName == null) ? 0 : fullName.hashCode());
    result = prime * result + (int) (id ^ (id >>> 32));
    result = prime * result + ((password == null) ? 0 : password.hashCode());
    result = prime * result + ((role == null) ? 0 : role.hashCode());
    result = prime * result + ((username == null) ? 0 : username.hashCode());
    return result;
}

public long getId() {
    return id;
}

public void setId(long id) {
    this.id = id;
}

public String getUsername() {
    return username;
}

public void setUsername(String username) {
    this.username = username;
}

public String getPassword() {
    return password;
}

public void setPassword(String password) {
    this.password = password;
}

public String getFullName() {
    return fullName;
}

public void setFullName(String fullName) {
    this.fullName = fullName;
}

public Role getRole() {
    return role;
}

public void setRole(Role role) {
    this.role = role;
}

public List<Project> getProjects() {
    return projects;
}

public void setProjects(List<Project> projects) {
    this.projects = projects;
}

public List<Task> getTasks() {
    return tasks;
}

public void setTasks(List<Task> tasks) {
    this.tasks = tasks;
}

public List<Meeting> getMeetings() {
    return meetings;
}

public void setMeetings(List<Meeting> meetings) {
    this.meetings = meetings;
}
}

PS:整个项目正在进行中。注意:您必须手动安装工件
ojdbc6-11.2.0.4.jar
,必要的jar(
ojdbc6
)位于项目文件夹中

这个警告只是一个警告。你可以通过耍花招来摆脱它,但这对你的实际问题没有帮助(这意味着这个问题的标题也很糟糕)。@Kayaman如果你愿意,我同意你编辑它:)你有日志文件吗?代码中持久化单元的名称正确吗?数据库连接正确吗?还是应该使用JNDI查找?@miw持久化单元和连接我认为是正确的。然后回到我的第一个问题:日志文件说什么?这将把“信念”变成“事实”。。。
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="ProjectManagerWeb" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
  <property name="javax.persistence.schema-generation.database.action" value="create-or-extend-tables"/>
  <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
  <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
  <property name="javax.persistence.jdbc.user" value="aleks"/>
  <property name="javax.persistence.jdbc.password" value="12345"/>
</properties>
</persistence-unit>
</persistence>
[2015-10-25T01:20:45.352+0300] [glassfish 4.1] [INFO] [NCLS-LOGGING-00009] [javax.enterprise.logging] [tid: _ThreadID=15 _ThreadName=RunLevelControllerThread-1445725244563] [timeMillis: 1445725245352] [levelValue: 800] [[
Running GlassFish Version: GlassFish Server Open Source Edition  4.1  (build 13)]]

[2015-10-25T01:20:45.359+0300] [glassfish 4.1] [INFO] [NCLS-LOGGING-00010] [javax.enterprise.logging] [tid: _ThreadID=15 _ThreadName=RunLevelControllerThread-1445725244563] [timeMillis: 1445725245359] [levelValue: 800] [[
Server log file is using Formatter class: com.sun.enterprise.server.logging.ODLLogFormatter]]

[2015-10-25T01:20:45.711+0300] [glassfish 4.1] [INFO] [NCLS-SECURITY-01115]  [javax.enterprise.system.core.security] [tid: _ThreadID=16  _ThreadName=RunLevelControllerThread-1445725244582] [timeMillis: 1445725245711]  [levelValue: 800] [[
Realm [admin-realm] of classtype   [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.]]

[2015-10-25T01:20:45.731+0300] [glassfish 4.1] [INFO] [NCLS-SECURITY-01115]   [javax.enterprise.system.core.security] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1445725244582] [timeMillis: 1445725245731] [levelValue: 800] [[
Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.]]

[2015-10-25T01:20:45.755+0300] [glassfish 4.1] [INFO] [NCLS-SECURITY-01115] [javax.enterprise.system.core.security] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1445725244582] [timeMillis: 1445725245755] [levelValue: 800] [[
Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.]]

[2015-10-25T01:20:46.397+0300] [glassfish 4.1] [INFO] [SEC-SVCS-00100] [javax.enterprise.security.services] [tid: _ThreadID=15 _ThreadName=RunLevelControllerThread-1445725244563] [timeMillis: 1445725246397] [levelValue: 800] [[
 Authorization Service has successfully initialized.]]

[2015-10-25T01:20:46.426+0300] [glassfish 4.1] [INFO] [] [org.glassfish.ha.store.spi.BackingStoreFactoryRegistry] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1445725244583] [timeMillis: 1445725246426] [levelValue: 800] [[
Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry]]

[2015-10-25T01:20:46.989+0300] [glassfish 4.1] [SEVERE] [NCLS-CORE-00043] [javax.enterprise.system.core] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725246989] [levelValue: 1000] [[
Application previously deployed is not at its original location any more: file:/C:/Users/Aleksandar/Desktop/WebProjectManager/target/WebProjectManager-0.0.1-SNAPSHOT/]]

[2015-10-25T01:20:48.112+0300] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1445725244582] [timeMillis: 1445725248112] [levelValue: 800] [[
Grizzly Framework 2.3.15 started in: 650ms - bound to [/0.0.0.0:8080]]]

[2015-10-25T01:20:48.251+0300] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1445725244582] [timeMillis: 1445725248251] [levelValue: 800] [[
Grizzly Framework 2.3.15 started in: 5ms - bound to [/0.0.0.0:8181]]]

[2015-10-25T01:20:48.375+0300] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=16 _ThreadName=RunLevelControllerThread-1445725244582] [timeMillis: 1445725248375] [levelValue: 800] [[
Grizzly Framework 2.3.15 started in: 81ms - bound to [/0.0.0.0:4848]]]

[2015-10-25T01:20:48.567+0300] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1445725244583] [timeMillis: 1445725248567] [levelValue: 800] [[
Grizzly Framework 2.3.15 started in: 3ms - bound to [/0.0.0.0:3700]]]

[2015-10-25T01:20:49.415+0300] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725249415] [levelValue: 800] [[
visiting unvisited references]]

[2015-10-25T01:20:51.662+0300] [glassfish 4.1] [INFO] [NCLS-SECURITY-01002] [javax.enterprise.system.core.security] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725251662] [levelValue: 800] [[
Java security manager is disabled.]]

[2015-10-25T01:20:51.663+0300] [glassfish 4.1] [INFO] [NCLS-SECURITY-01010] [javax.enterprise.system.core.security] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725251663] [levelValue: 800] [[
 Entering Security Startup Service.]]

[2015-10-25T01:20:51.676+0300] [glassfish 4.1] [INFO] [NCLS-SECURITY-01143] [javax.enterprise.system.core.security] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725251676] [levelValue: 800] [[
 Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.]]

 [2015-10-25T01:20:51.801+0300] [glassfish 4.1] [INFO] [NCLS-SECURITY-01011] [javax.enterprise.system.core.security] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725251801] [levelValue: 800] [[
 Security Service(s) started successfully.]]

[2015-10-25T01:20:52.707+0300] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00198] [javax.enterprise.web] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725252707] [levelValue: 800] [[
Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080]]

[2015-10-25T01:20:52.740+0300] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00198] [javax.enterprise.web] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725252740] [levelValue: 800] [[
 Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181]]

 [2015-10-25T01:20:52.748+0300] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00198] [javax.enterprise.web] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725252748] [levelValue: 800] [[
 Created HTTP listener admin-listener on host/port 0.0.0.0:4848]]

[2015-10-25T01:20:52.861+0300] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00200] [javax.enterprise.web] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725252861] [levelValue: 800] [[
 Created virtual server server]]

[2015-10-25T01:20:52.867+0300] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00200] [javax.enterprise.web] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725252867] [levelValue: 800] [[
Created virtual server __asadmin]]

[2015-10-25T01:20:53.588+0300] [glassfish 4.1] [INFO] [AS-WEB-CORE-00306] [javax.enterprise.web.core] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725253588] [levelValue: 800] [[
Setting JAAS app name glassfish-web]]

[2015-10-25T01:20:53.590+0300] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00201] [javax.enterprise.web] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725253590] [levelValue: 800] [[
Virtual server server loaded default web module ]]

[2015-10-25T01:20:55.788+0300] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725255788] [levelValue: 800] [[
 visiting unvisited references]]

 [2015-10-25T01:20:55.918+0300] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725255918] [levelValue: 800] [[
 visiting unvisited references]]

 [2015-10-25T01:20:55.924+0300] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725255924] [levelValue: 800] [[
 visiting unvisited references]]

[2015-10-25T01:20:55.928+0300] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725255928] [levelValue: 800] [[
visiting unvisited references]]

[2015-10-25T01:20:57.299+0300] [glassfish 4.1] [WARNING] []   [javax.enterprise.web.util] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725257299]  [levelValue: 900] [[
The web application [unknown] registered the JDBC driver [oracle.jdbc.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.]]

[2015-10-25T01:21:01.234+0300] [glassfish 4.1] [INFO] [jsf.config.listener.version] [javax.enterprise.resource.webcontainer.jsf.config] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725261234] [levelValue: 800] [[
Initializing Mojarra 2.2.7 ( 20140610-1547 https://svn.java.net/svn/mojarra~svn/tags/2.2.7@13362) for context '/ProjectManagerWeb']]

[2015-10-25T01:21:04.255+0300] [glassfish 4.1] [INFO] [] [org.hibernate.validator.internal.util.Version] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725264255] [levelValue: 800] [[
 HV000001: Hibernate Validator 5.0.0.Final]]

[2015-10-25T01:21:06.388+0300] [glassfish 4.1] [INFO] [] [org.primefaces.webapp.PostConstructApplicationEventListener] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725266388] [levelValue: 800] [[
 Running on PrimeFaces 5.0]]

[2015-10-25T01:21:06.406+0300] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725266406] [levelValue: 800] [[
Loading application [ProjectManagerWeb] at [/ProjectManagerWeb]]]

[2015-10-25T01:21:06.434+0300] [glassfish 4.1] [INFO] [NCLS-CORE-00022] [javax.enterprise.system.core] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725266434] [levelValue: 800] [[
Loading application ProjectManagerWeb done in 19 444 ms]]

[2015-10-25T01:21:06.439+0300] [glassfish 4.1] [INFO] [NCLS-CORE-00017] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1445725266439] [levelValue: 800] [[
GlassFish Server Open Source Edition  4.1  (13) startup time : Felix (26 644ms), startup services(21 890ms), total(48 534ms)]]

[2015-10-25T01:21:06.775+0300] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=14 _ThreadName=RunLevelControllerThread-1445725244560] [timeMillis: 1445725266775] [levelValue: 800] [[
Grizzly Framework 2.3.15 started in: 4ms - bound to [/0.0.0.0:7676]]]

[2015-10-25T01:21:07.160+0300] [glassfish 4.1] [INFO] [NCLS-BOOTSTRAP-00027]  [javax.enterprise.bootstrap] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1445725267160] [levelValue: 800] [[
Registered  com.sun.enterprise.glassfish.bootstrap.osgi.EmbeddedOSGiGlassFishImpl@10ee03a as  OSGi service registration:  org.apache.felix.framework.ServiceRegistrationImpl@1f94401.]]

[2015-10-25T01:21:08.189+0300] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00198] [javax.enterprise.web] [tid: _ThreadID=88 _ThreadName=pool-20-thread-1] [timeMillis: 1445725268189] [levelValue: 800] [[
Created HTTP listener http-listener-2 on host/port 0.0.0.0:8181]]

[2015-10-25T01:21:08.307+0300] [glassfish 4.1] [INFO] [NCLS-JMX-00005] [javax.enterprise.system.jmx] [tid: _ThreadID=64 _ThreadName=Thread-16] [timeMillis: 1445725268307] [levelValue: 800] [[
 JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://213.191.173.213:8686/jndi/rmi://213.191.173.213:8686/jmxrmi]]

[2015-10-25T01:21:08.375+0300] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=88 _ThreadName=pool-20-thread-1] [timeMillis: 1445725268375] [levelValue: 800] [[
Grizzly Framework 2.3.15 started in: 62ms - bound to [/0.0.0.0:8181]]]

[2015-10-25T01:21:08.775+0300] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00198] [javax.enterprise.web] [tid: _ThreadID=85 _ThreadName=pool-19-thread-1]  [timeMillis: 1445725268775] [levelValue: 800] [[
 Created HTTP listener http-listener-1 on host/port 0.0.0.0:8080]]

 [2015-10-25T01:21:08.788+0300] [glassfish 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=85 _ThreadName=pool-19-thread-1] [timeMillis: 1445725268788] [levelValue: 800] [[
 Grizzly Framework 2.3.15 started in: 4ms - bound to [/0.0.0.0:8080]]]

[2015-10-25T01:21:10.976+0300] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1445725270976] [levelValue: 800] [[
visiting unvisited references]]

[2015-10-25T01:21:11.582+0300] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1445725271582] [levelValue: 800] [[
 visiting unvisited references]]

[2015-10-25T01:21:11.613+0300] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1445725271613] [levelValue: 800] [[
 visiting unvisited references]]

 [2015-10-25T01:21:11.619+0300] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1445725271619] [levelValue: 800] [[
 visiting unvisited references]]

 [2015-10-25T01:21:11.622+0300] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1445725271622] [levelValue: 800] [[
  visiting unvisited references]]

  [2015-10-25T01:21:14.544+0300] [glassfish 4.1] [INFO] [jsf.config.listener.version] [javax.enterprise.resource.webcontainer.jsf.config] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1445725274544] [levelValue: 800] [[
  Initializing Mojarra 2.2.7 ( 20140610-1547 https://svn.java.net/svn/mojarra~svn/tags/2.2.7@13362) for context '/ProjectManagerWeb']]

  [2015-10-25T01:21:16.323+0300] [glassfish 4.1] [INFO] [] [org.primefaces.webapp.PostConstructApplicationEventListener] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1445725276323] [levelValue: 800] [[
  Running on PrimeFaces 5.0]]

  [2015-10-25T01:21:16.390+0300] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1445725276390] [levelValue: 800] [[
   Loading application [ProjectManagerWeb] at [/ProjectManagerWeb]]]

 [2015-10-25T01:21:16.532+0300] [glassfish 4.1] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=45 _ThreadName=admin-listener(5)] [timeMillis: 1445725276532] [levelValue: 800] [[
  ProjectManagerWeb was successfully deployed in 6 841 milliseconds.]]