jimb0p
Erfahrenes Mitglied
Hallo Zusammen,
beim ersten Versuch meine EntityManagerFactory zu erstellen, bekomme ich die im Betreff angegebene Exception. Meine main habe ich auf das folgende zum Testen gekürzt:
Meine persistence.xml sieht wie folgt aus:
Meine Entity sieht wie folgt aus:
Als Libraries sind eingebunden JPA 2.0-2.0 (javax.persistence.jar), org.hibernate:hibernate-core:5.2.10.Final und sqljdbc42.
Kann mir jemand sagen warum der Fehler geworfen wird beim erstellen der EntityManagerFactory?
Gruß!
beim ersten Versuch meine EntityManagerFactory zu erstellen, bekomme ich die im Betreff angegebene Exception. Meine main habe ich auf das folgende zum Testen gekürzt:
Java:
mport javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class MainClass {
public static void main (String[] args) {
final EntityManagerFactory entityManagerFactory =
Persistence.createEntityManagerFactory("NewPersistenceUnit");
}
}
Meine persistence.xml sieht wie folgt aus:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="NewPersistenceUnit">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>de.bla.main.TbenutzerEntity</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.connection.url" value="jdbc:sqlserver://localhost\MSSQLSERVER:37084;databaseName=EinsZwei"/>
<property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value="password"/>
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
Meine Entity sieht wie folgt aus:
Java:
package de.bla.main;
import javax.persistence.*;
@Entity
@Table(name = "tbenutzer", schema = "dbo", catalog = "EinsZwei")
public class TbenutzerEntity {
private int kBenutzer;
private String cLogin;
private String cPasswort;
private String cName;
private Integer kFirma;
private String cTel;
private String cEMail;
private String cAbteilung;
private String cFax;
private String cMobil;
private String cHinweis;
private String iSalt;
@Id
@Column(name = "kBenutzer")
public int getkBenutzer() {
return kBenutzer;
}
public void setkBenutzer(int kBenutzer) {
this.kBenutzer = kBenutzer;
}
@Basic
@Column(name = "cLogin")
public String getcLogin() {
return cLogin;
}
public void setcLogin(String cLogin) {
this.cLogin = cLogin;
}
@Basic
@Column(name = "cPasswort")
public String getcPasswort() {
return cPasswort;
}
public void setcPasswort(String cPasswort) {
this.cPasswort = cPasswort;
}
@Basic
@Column(name = "cName")
public String getcName() {
return cName;
}
public void setcName(String cName) {
this.cName = cName;
}
@Basic
@Column(name = "kFirma")
public Integer getkFirma() {
return kFirma;
}
public void setkFirma(Integer kFirma) {
this.kFirma = kFirma;
}
@Basic
@Column(name = "cTel")
public String getcTel() {
return cTel;
}
public void setcTel(String cTel) {
this.cTel = cTel;
}
@Basic
@Column(name = "cEMail")
public String getcEMail() {
return cEMail;
}
public void setcEMail(String cEMail) {
this.cEMail = cEMail;
}
@Basic
@Column(name = "cAbteilung")
public String getcAbteilung() {
return cAbteilung;
}
public void setcAbteilung(String cAbteilung) {
this.cAbteilung = cAbteilung;
}
@Basic
@Column(name = "cFax")
public String getcFax() {
return cFax;
}
public void setcFax(String cFax) {
this.cFax = cFax;
}
@Basic
@Column(name = "cMobil")
public String getcMobil() {
return cMobil;
}
public void setcMobil(String cMobil) {
this.cMobil = cMobil;
}
@Basic
@Column(name = "cHinweis")
public String getcHinweis() {
return cHinweis;
}
public void setcHinweis(String cHinweis) {
this.cHinweis = cHinweis;
}
@Basic
@Column(name = "iSalt")
public String getiSalt() {
return iSalt;
}
public void setiSalt(String iSalt) {
this.iSalt = iSalt;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TbenutzerEntity that = (TbenutzerEntity) o;
if (kBenutzer != that.kBenutzer) return false;
if (cLogin != null ? !cLogin.equals(that.cLogin) : that.cLogin != null) return false;
if (cPasswort != null ? !cPasswort.equals(that.cPasswort) : that.cPasswort != null) return false;
if (cName != null ? !cName.equals(that.cName) : that.cName != null) return false;
if (kFirma != null ? !kFirma.equals(that.kFirma) : that.kFirma != null) return false;
if (cTel != null ? !cTel.equals(that.cTel) : that.cTel != null) return false;
if (cEMail != null ? !cEMail.equals(that.cEMail) : that.cEMail != null) return false;
if (cAbteilung != null ? !cAbteilung.equals(that.cAbteilung) : that.cAbteilung != null) return false;
if (cFax != null ? !cFax.equals(that.cFax) : that.cFax != null) return false;
if (cMobil != null ? !cMobil.equals(that.cMobil) : that.cMobil != null) return false;
if (cHinweis != null ? !cHinweis.equals(that.cHinweis) : that.cHinweis != null) return false;
if (iSalt != null ? !iSalt.equals(that.iSalt) : that.iSalt != null) return false;
return true;
}
@Override
public int hashCode() {
int result = kBenutzer;
result = 31 * result + (cLogin != null ? cLogin.hashCode() : 0);
result = 31 * result + (cPasswort != null ? cPasswort.hashCode() : 0);
result = 31 * result + (cName != null ? cName.hashCode() : 0);
result = 31 * result + (kFirma != null ? kFirma.hashCode() : 0);
result = 31 * result + (cTel != null ? cTel.hashCode() : 0);
result = 31 * result + (cEMail != null ? cEMail.hashCode() : 0);
result = 31 * result + (cAbteilung != null ? cAbteilung.hashCode() : 0);
result = 31 * result + (cFax != null ? cFax.hashCode() : 0);
result = 31 * result + (cMobil != null ? cMobil.hashCode() : 0);
result = 31 * result + (cHinweis != null ? cHinweis.hashCode() : 0);
result = 31 * result + (iSalt != null ? iSalt.hashCode() : 0);
return result;
}
}
Als Libraries sind eingebunden JPA 2.0-2.0 (javax.persistence.jar), org.hibernate:hibernate-core:5.2.10.Final und sqljdbc42.
Kann mir jemand sagen warum der Fehler geworfen wird beim erstellen der EntityManagerFactory?
Gruß!