zoukankan      html  css  js  c++  java
  • Hibernater入门笔记

    内容来自http://www.cnblogs.com/sunniest/p/4539817.html

    Hibernater入门笔记

     

      一、照例,导包

         jar包来源 http://hibernate.org/orm/

      二、配置hibernate.cfg.xml文件

      1. 在src目录下创建hibernate.cfg.xml文件(!!!必须是这个名字)
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!DOCTYPE hibernate-configuration PUBLIC 
     3           "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 
     4           "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
     5 <hibernate-configuration>
     6     <session-factory>
     7 
     8         <!-- 数据源 -->
     9         <property name="connection.username">root</property>
    10         <property name="connection.password">1234</property>
    11         <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    12         <property name="connection.url">jdbc:mysql://localhost:3306/test</property>
    13 
    14         <!-- configure the hibernate setting -->
    15         <!-- transaction is supported by org.hibernate.dialect.MySQL5InnoDBDialect -->
    16         <property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
    17         <!-- show sql in the console -->
    18         <property name="show_sql">true</property>
    19      <!-- create and update the database automaticlly -->
    20         <property name="hbm2ddl.auto">update</property>
    21         
    22         <!-- javax.persistence.validation.mode默认情况下是auto的,就是说如果不设置的话它是会自动去你的classpath下面找一个
    23         bean-validation**包,但是找不到,所以beanvalitionFactory错误 -->
    24         <property name="javax.persistence.validation.mode">none</property>
    25     
    26     </session-factory>
    27 </hibernate-configuration>
  • 相关阅读:
    提升request模块的效率--线程池
    selenium的用法
    SVN 常用命令
    SVN 常见问题及解决方法
    Makefile 详解
    开心一刻(一)
    Vim配置及其他注意事项
    彩虹表
    C++学习之STL(二)String
    C++学习之STL(一)vector
  • 原文地址:https://www.cnblogs.com/zhanglixuan/p/6714327.html
Copyright © 2011-2022 走看看