0
私は数日間このことを研究していました。シンプルなYouTubeのチュートリアルに従ってください私は私の休止状態を設定しようとしています。以下のクラスはすべて私が作成したクラスですが、私は自分のランタイム設定をチェックしました。彼らはドライバを持っていますので、ビルドパスも同じです。私は何が欠けているのか分からない、すぐに助けてください!休止時間を統合する際の実行時エラー
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>
エンティティ:
@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;
}
}
サービス:
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();
}
}