2016-08-09 15 views
0

Ich habe seit einigen Tagen darüber recherchiert. Folgen Sie einfach Youtube Tutorial ich versuche, meinen Ruhezustand einzurichten. Folgende sind alle Klassen, die ich erstellt habe, aber ich habe meine Laufzeitkonfiguration überprüft, sie haben den Treiber und so funktioniert der Build-Pfad. Ich verstehe nicht, was fehlt, bitte helfen Sie bald!Laufzeitfehler beim Integrieren des Ruhezustands

hibernate.cfg.xml

<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/nebuladb</property> 
    <property name="hibernate.connection.username">****</property> 
    <property name="hibernate.connection.password">****</property> 
    <property name="hibernate.connection.driver_class">org.postgresql.driver</property> 
    <property name="hibernate.connection.pool_size">1</property> 
    <property name="hibernate.connection.dialect">org.hibernate.dialect.PostgreSQLDialect</property> 
    <property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property> 
    <property name="hibernate.show_sql">true</property> 
    <property name="hibernate.hbm2ddl.auto">create</property> 
    <mapping class="careers.nebula.ben.db.enitity.signup.UserEntity"/> 
</session-factory> 

Einheit:

@Entity 
public class UserEntity { 
@Id 
private int id; 
private String firstName; 
private String lastName; 
private String preferredName; 
private String phoneNumber; 
private String email; 
private String photoUrl; 
private String videoUrl; 
private String personalWebsiteUrl; 
private String fbUrl; 
private String linkedinUrl; 
private String goals; 
private String aboutMe; 
private Boolean currentlyEmployeed; 
private Boolean currentlyInSchool; 
private String highestQualification; 
private int rating; 

public int getId() { 
    return id; 
} 
public void setId(int id) { 
    this.id = id; 
} 
public String getFirstName() { 
    return firstName; 
} 
public void setFirstName(String firstName) { 
    this.firstName = firstName; 
} 
public String getLastName() { 
    return lastName; 
} 
public void setLastName(String lastName) { 
    this.lastName = lastName; 
} 
public String getPreferredName() { 
    return preferredName; 
} 
public void setPreferredName(String preferredName) { 
    this.preferredName = preferredName; 
} 
public String getPhoneNumber() { 
    return phoneNumber; 
} 
public void setPhoneNumber(String phoneNumber) { 
    this.phoneNumber = phoneNumber; 
} 
public String getEmail() { 
    return email; 
} 
public void setEmail(String email) { 
    this.email = email; 
} 
public String getPhotoUrl() { 
    return photoUrl; 
} 
public void setPhotoUrl(String photoUrl) { 
    this.photoUrl = photoUrl; 
} 
public String getVideoUrl() { 
    return videoUrl; 
} 
public void setVideoUrl(String videoUrl) { 
    this.videoUrl = videoUrl; 
} 
public String getPersonalWebsiteUrl() { 
    return personalWebsiteUrl; 
} 
public void setPersonalWebsiteUrl(String personalWebsiteUrl) { 
    this.personalWebsiteUrl = personalWebsiteUrl; 
} 
public String getGoals() { 
    return goals; 
} 
public void setGoals(String goals) { 
    this.goals = goals; 
} 
public String getAboutMe() { 
    return aboutMe; 
} 
public void setAboutMe(String aboutMe) { 
    this.aboutMe = aboutMe; 
} 
public Boolean getCurrentlyEmployeed() { 
    return currentlyEmployeed; 
} 
public void setCurrentlyEmployeed(Boolean currentlyEmployeed) { 
    this.currentlyEmployeed = currentlyEmployeed; 
} 
public Boolean getCurrentlyInSchool() { 
    return currentlyInSchool; 
} 
public void setCurrentlyInSchool(Boolean currentlyInSchool) { 
    this.currentlyInSchool = currentlyInSchool; 
} 
public String getHighestQualification() { 
    return highestQualification; 
} 
public void setHighestQualification(String highestQualification) { 
    this.highestQualification = highestQualification; 
} 
public int getRating() { 
    return rating; 
} 
public void setRating(int rating) { 
    this.rating = rating; 
} 
public String getFbUrl() { 
    return fbUrl; 
} 
public void setFbUrl(String fbUrl) { 
    this.fbUrl = fbUrl; 
} 
public String getLinkedinUrl() { 
    return linkedinUrl; 
} 
public void setLinkedinUrl(String linkedinUrl) { 
    this.linkedinUrl = linkedinUrl; 
} 
} 

Service:

public class UserInformation { 


public static void main(String[] args){ 
    UserEntity userEntity = new UserEntity(); 
    userEntity.setFirstName("Ankit"); 
    userEntity.setLastName("Verma"); 
    userEntity.setPreferredName("ankibunkers"); 
    userEntity.setPhoneNumber("9097172039"); 
    userEntity.setEmail("[email protected]"); 
    userEntity.setCurrentlyInSchool(false); 
    userEntity.setCurrentlyEmployeed(true); 
    userEntity.setGoals("earn my masters in computer science from harvard"); 
    userEntity.setAboutMe("passionate young attractive stud"); 
    userEntity.setPhotoUrl("www.photo.url.com"); 
    userEntity.setVideoUrl("www.video.url.com"); 
    userEntity.setFbUrl("www.fb.url.com"); 
    userEntity.setLinkedinUrl("www.linkedin.url.com"); 
    userEntity.setRating(4); 

    SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); 
    Session session = sessionFactory.openSession(); 
    session.beginTransaction(); 
    session.save(userEntity); 
    session.getTransaction().commit(); 
} 
} 

Antwort

0

die Treiber-URL postgresql.driver muss postgresql.Driver sein. Hoppla!

Verwandte Themen