你的位置:
首页
>
软件开发 >
Java > 玩玩Hibernate(二)hibernate
玩玩Hibernate(二)hibernate
发布时间:2016-03-02 20:00:09
新建一个hSpider的工程,引入前面已经建立的lib并为其建立一个hibernate.cfg. 1 <??> 2 <!DOCTYPE hibernate-configuration PUBLIC 3 "-//Hibernate/Hiberna ...
新建一个hSpider的工程,引入前面已经建立的lib
并为其建立一个hibernate.cfg.
1 <??> 2 <!DOCTYPE hibernate-configuration PUBLIC 3 "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 4 "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 5 6 <hibernate-configuration> 7 8 <session-factory> 9 10 <!-- Database connection settings 数据库的配置 -->11 <property name="connection.driver_class">com.mysql.jdbc.Driver</property>12 <property name="connection.url">jdbc:mysql://localhost:3306/hSpider</property>13 <property name="connection.username">root</property>14 <property name="connection.password"></property>15 16 <!-- JDBC connection pool (use the built-in) hibernate自带连接池,暂不使用 -->17 <!-- <property name="connection.pool_size">1</property> -->18 19 <!-- SQL dialect 数据库方言,这里我们才爱用MySQL-->20 <property name="dialect">org.hibernate.dialect.MySQLDialect</property>21 22 <!-- Enable Hibernate's automatic session context management 新功能,暂不使用 -->23 <!-- <property name="current_session_context_class">thread</property> -->24 25 <!-- Disable the second-level cache 二级缓存,放置不管 -->26 <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>27 28 <!-- Echo all executed SQL to stdout 设置show_sql为true表示让hibernate将生成sql语句在控制台打印出来 -->29 <property name="show_sql">true</property>30 31 <!-- Drop and re-create the database schema on startup 是否让hibernate自动为我们创建表 -->32 <!-- <property name="hbm2ddl.auto">update</property> -->33 34 <mapping resource="hibernateSpider/edNews.hbm./> <!-- 这里是将需要mapping的文件进行再次声明 -->35 36 </session-factory>37 38 </hibernate-configuration>
原标题:玩玩Hibernate(二)hibernate
关键词:Hibernate
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。
揭示消费者数字购物行为背后的秘密:https://www.goluckyvip.com/tag/34689.html
PPC广告:https://www.goluckyvip.com/tag/3469.html
街头π老王:https://www.goluckyvip.com/tag/34690.html
节礼日:https://www.goluckyvip.com/tag/34691.html
节日&派对用品:https://www.goluckyvip.com/tag/34692.html
节日活动:https://www.goluckyvip.com/tag/34693.html
长治婚庆女司仪和主持人:https://www.vstour.cn/a/366176.html
北京丰台区水上乐园哪家好玩?:https://www.vstour.cn/a/366177.html