Hibernate初学

package com.hanqi.entity;

import java.util.Date;

public class T_BankCard {

    private String cardID;
    private String userID;
    private String userName;
    private String password;
    private double balance;
    private String state;
    private Date createTime;
    public String getCardID() {
        return cardID;
    }
    public void setCardID(String cardID) {
        this.cardID = cardID;
    }
    public String getUserID() {
        return userID;
    }
    public void setUserID(String userID) {
        this.userID = userID;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public double getBalance() {
        return balance;
    }
    public void setBalance(double balance) {
        this.balance = balance;
    }
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public T_BankCard(String cardID, String userID, String userName, String password, double balance, String state,
            Date createTime) {
        super();
        this.cardID = cardID;
        this.userID = userID;
        this.userName = userName;
        this.password = password;
        this.balance = balance;
        this.state = state;
        this.createTime = createTime;
    }
    public T_BankCard() {
        super();
    }
    
}
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 2016-11-7 16:50:51 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
    <class name="com.hanqi.entity.T_BankCard" table="A_BANKCARD">
        <id name="cardID" type="java.lang.String">
            <column name="CARD_ID" length="20" />
            <generator class="assigned" />
        </id>
        <property name="userID" type="java.lang.String">
            <column name="USER_ID" length="30" />
        </property>
        <property name="userName" type="java.lang.String">
            <column name="USER_NAME" length="30" />
        </property>
        <property name="password" type="java.lang.String">
            <column name="PASSWORD" length="8" />
        </property>
        <property name="balance" type="double">
            <column name="BALANCE" length="20" scale="3" />
        </property>
        <property name="state" type="java.lang.String">
            <column name="STATE" />
        </property>
        <property name="createTime" type="java.util.Date">
            <column name="CREATE_TIME" />
        </property>
    </class>
</hibernate-mapping>
<?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="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
  <property name="hibernate.connection.password">12345678</property>
  <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
  <property name="hibernate.connection.username">test0816</property>
  <!-- 数据库方案 -->
  <property name="hibernate.default_schema">TEST0816</property>
    <!--  数据库方言-->
  
  <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
    <!--调试  -->
  
  <property name="hibernate.show_sql">true</property>
  <property name="hibernate.format_sql">true</property>
    <!--  -->
    <!--自动建表方式  -->
  
  <property name="hibernate.hbm2ddl.auto">update</property>
    <!-- 映射文件 -->
  
  <mapping resource="com/hanqi/entity/T_BANKCARD.hbm.xml"/>
 </session-factory>
 <security context="show"/>
</hibernate-configuration>

posted @ 2016-11-07 19:53  wangguoning  阅读(179)  评论(0编辑  收藏  举报