hibernate第一个例子

http://blog.csdn.net/doodoofish/archive/2004/07/16/43207.aspx

hibernate: www.hibernet.org -> sf.net

ant:ant.apache.org

Oracle jdbc: http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html

1、当前的hibernate(hibernate core)文件名是hibernate-distribution-3.3.2.GA-dist.zip

2、编译出错,需要slf4j,即slf4j-1.5.8.zip,提取其中的slf4j-nop-1.5.8.jar文件,和hibernate3.jar放在一起;

3、我的oracle版本是10.2.0.1.0,java是1.6的,下了一个for 1.4/1.5的,ojdbc14.jar

4、连接数据库出错,connection.username应该是sys as sysdba

hibernate.cfg.xml内容如下

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
   
    <session-factory name="java:/hibernate/HibernateFactory">
       
        <property name="show_sql">true</property>
        <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
        <property name="connection.username">sys as sysdba</property>
        <property name="connection.password">orcl</property>
        <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
       
        <mapping resource="Customer.hbm.xml" />
       
    </session-factory>
   
</hibernate-configuration>


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/chuqingq2/archive/2009/07/22/4371639.aspx

你可能感兴趣的:(oracle,Hibernate,.net,jdbc,ant)