第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

請(qǐng)問(wèn)老師Unknown entity: cqu.edu.entity.Students怎么解決呢

請(qǐng)問(wèn)老師Unknown entity: cqu.edu.entity.Students怎么解決呢

風(fēng)中沙 2015-11-23 17:35:47
測(cè)試類(lèi):@Test public void testSaveStudent(){ Configuration cfg = new Configuration();? ? ? ? cfg.configure(); Session session = MyHibernateSessionFactory.getSessionFactory().getCurrentSession(); session.beginTransaction(); Transaction tx=session.beginTransaction(); ?? ? ? // cfg.addClass(cqu.edu.entity.Students.class);? Students student1=new Students("S0000001","張三","男",new Date(),"重慶"); Students student2=new Students("S0000002","李四","男",new Date(),"海南"); Students student3=new Students("S0000003","王五","男",new Date(),"四川"); session.save(student1); session.save(student2); session.save(student3); tx.commit();}hibernate.cfg.xml文件:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-configuration PUBLIC?"-//Hibernate/Hibernate Configuration DTD 3.0//EN"?"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">?<hibernate-configuration> ?? ? <session-factory >??? ? <property name ="connection.username">root</property>?? ? <property name ="connection.password">123456</property>?? ? <property name= "connection.driver_class">com.mysql.jdbc.Driver </property >? ? ? <!-- 驅(qū)動(dòng)路徑 -->??? ? <property name= "connection.url">jdbc:mysql://127.0.0.1:3306/students_database?useUnicode=true&amp;characterEncoding=UTF-8</property ><!-- 連接數(shù)據(jù)庫(kù)字符串 --> ??? ? <property name= "hibernate.dialect">org.hibernate.dialect.MySQLDialect</property >??? ? <property name ="show_sql">true</property> ? ? <!-- 顯示SQL語(yǔ)句 --> ??? ? <property name ="format_sql">true</property> ??? ? <property name ="hbm2ddl.auto">update</property> ? ?? ? ? ? ? ? <!-- 配置使用session.getCurrentSession()方法 -->?? ? <property name= "hibernate.current_session_context_class" >thread</property >??? ? <property name="javax.persistence.validation.mode">none</property>??? ? <!-- hbm.xml -->?? ? <mapping resource ="cqu/edu/entity/Users.hbm.xml"/> <mapping resource ="cqu/edu/entity/yStudents.hbm.xml"/>?? ?? ? </session-factory >?</hibernate-configuration>? ?相應(yīng)的Students.hbm.xml文件:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-mapping PUBLIC? ?? ? "-//Hibernate/Hibernate Mapping DTD 3.0//EN" ?? ? "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"><hibernate-mapping>?? <class name="cqu.edu.entity.Students" table="STUDENTS">?? <id name="sid" type="java.lang.String"? length="8">?? <generator class="assigned"/>?? </id>?? <property name="sname" type="java.lang.String"></property>?? <property name="gender" type="java.lang.String"></property>?? <property name="birthday" type="java.util.Date"></property>?? <property name="address" type="java.lang.String"></property>? ? ?? </class></hibernate-mapping> ?謝謝!
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 2431 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)