锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲精品免费观看,亚洲伦理中文字幕,亚洲国产成人在线视频http://www.tkk7.com/supercrsky/category/27643.html涓撴敞浜嶫avaWeb寮鍙?/description>zh-cnWed, 23 Sep 2009 12:17:28 GMTWed, 23 Sep 2009 12:17:28 GMT60鍩轟簬鎸塧nnotation鐨刪ibernate涓婚敭鐢熸垚絳栫暐http://www.tkk7.com/supercrsky/articles/296122.html銆呬笂鍠勮嫢姘淬?/dc:creator>銆呬笂鍠勮嫢姘淬?/author>Wed, 23 Sep 2009 02:00:00 GMThttp://www.tkk7.com/supercrsky/articles/296122.htmlhttp://www.tkk7.com/supercrsky/comments/296122.htmlhttp://www.tkk7.com/supercrsky/articles/296122.html#Feedback0http://www.tkk7.com/supercrsky/comments/commentRss/296122.htmlhttp://www.tkk7.com/supercrsky/services/trackbacks/296122.html闃呰鍏ㄦ枃

]]>
Hibernate浜岀駭緙撳瓨璇﹁Вhttp://www.tkk7.com/supercrsky/articles/238580.html銆呬笂鍠勮嫢姘淬?/dc:creator>銆呬笂鍠勮嫢姘淬?/author>Tue, 04 Nov 2008 05:50:00 GMThttp://www.tkk7.com/supercrsky/articles/238580.htmlhttp://www.tkk7.com/supercrsky/comments/238580.htmlhttp://www.tkk7.com/supercrsky/articles/238580.html#Feedback0http://www.tkk7.com/supercrsky/comments/commentRss/238580.htmlhttp://www.tkk7.com/supercrsky/services/trackbacks/238580.html闃呰鍏ㄦ枃

]]>
鍩轟簬JPA鐨凜RUD(OneToMany)http://www.tkk7.com/supercrsky/articles/164302.html銆呬笂鍠勮嫢姘淬?/dc:creator>銆呬笂鍠勮嫢姘淬?/author>Fri, 30 Nov 2007 07:42:00 GMThttp://www.tkk7.com/supercrsky/articles/164302.htmlhttp://www.tkk7.com/supercrsky/comments/164302.htmlhttp://www.tkk7.com/supercrsky/articles/164302.html#Feedback0http://www.tkk7.com/supercrsky/comments/commentRss/164302.htmlhttp://www.tkk7.com/supercrsky/services/trackbacks/164302.html闃呰鍏ㄦ枃

]]>
鍩轟簬JPA鐨凥ibernate->CRUD(綆鍗曞簲鐢?(鍘熷垱)http://www.tkk7.com/supercrsky/articles/163902.html銆呬笂鍠勮嫢姘淬?/dc:creator>銆呬笂鍠勮嫢姘淬?/author>Thu, 29 Nov 2007 01:08:00 GMThttp://www.tkk7.com/supercrsky/articles/163902.htmlhttp://www.tkk7.com/supercrsky/comments/163902.htmlhttp://www.tkk7.com/supercrsky/articles/163902.html#Feedback0http://www.tkk7.com/supercrsky/comments/commentRss/163902.htmlhttp://www.tkk7.com/supercrsky/services/trackbacks/163902.html 鑴氭湰濡備笅:
use test;
create table person
(
 id 
int AUTO_INCREMENT primary key,
 username 
varchar(20),
 password 
varchar(20)
);

insert into person values(null,'ts','ts');
瀹炰綋綾葷敤Annotation鏄犲皠,浠f浛hbm.
package com.vo;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@SuppressWarnings(
"unchecked""serial" })
@Entity 
//鏍囪瘑鏄竴涓疄浣?/span>
@Table(name="person"//鏄犲皠琛?/span>
public class Person implements Serializable
{
    
//涓婚敭鏄犲皠
    @Id
    
//涓婚敭鑷
    @GeneratedValue(strategy=GenerationType.AUTO)
    
private Integer id;
    
//@Column(name="username"),瀵逛簬鍒?鍙槧灝勪篃鍙互涓嶆槧灝?娉ㄦ剰淇濇寔鍒楀悕鍜屽睘鎬у悕涓鑷村氨琛?nbsp;
    private String username;
    
private String password;

    
public Integer getId()
    
{
        
return id;
    }


    
public void setId(Integer id)
    
{
        
this.id = id;
    }


    
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;
    }

}


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="dialect">org.hibernate.dialect.MySQLDialect</property>
        
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        
<property name="connection.url">jdbc:mysql://localhost:3306/test</property>
        
<property name="connection.username">root</property>
        
<property name="connection.password">root</property>
        
<property name="show_sql">true</property>
        
<!-- 瀹炰綋綾繪槧灝?nbsp;-->
        
<mapping class="com.vo.Person"/>
    
</session-factory>
</hibernate-configuration>    
嫻嬭瘯綾?
package com.test;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.AnnotationConfiguration;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import com.vo.Person;

public class PersonTest
{
    
private Session session;
    
private Transaction tx;

    @Before
    
public void before()
    
{
        session 
= new AnnotationConfiguration().configure()
                .buildSessionFactory().openSession();
        tx 
= session.getTransaction();
    }


    @After
    
public void after()
    
{
        session.close();
    }


    @Test
    
public void testSave()
    
{
        tx.begin();
        Person person 
= new Person();
        person.setUsername(
"zdw");
        person.setPassword(
"admin");
        session.save(person);
        tx.commit();
    }

    
    @Test
    
public void testUpdate()
    
{
        tx.begin();
        Person person 
= (Person) session.load(Person.class1);
        person.setPassword(
"test");
        session.update(person);
        tx.commit();
    }

    @SuppressWarnings(
"unchecked")
    @Test
    
public void testQueryAll()
    
{
        List
<Person> persons = session.createCriteria(Person.class).list();
        assertNotNull(persons);
    }

    
    @Test
    
public void testDelete()
    
{
        Person person 
= (Person) session.load(Person.class1);
        session.delete(person);
    }

}

緇忔祴璇?澧炲垹鏀規煡鍏ㄩ儴姝e父.
榪欐牱鐨勭‘寰堟柟渚夸簡.
婧愮爜鍙互鍦ㄦ垜鐨勭綉鐩樹笅杞? 鐐規涓嬭澆

]]>
主站蜘蛛池模板: 男女超爽视频免费播放| 亚洲精品偷拍视频免费观看| 你懂的在线免费观看| 亚洲AV日韩AV一区二区三曲| 亚洲自偷自拍另类图片二区| 亚洲精品成人无限看| 免费看国产一级片| 香蕉高清免费永久在线视频| 亚洲热妇无码AV在线播放| 日本免费一区二区三区最新vr| 蜜臀AV免费一区二区三区| 伊人免费在线观看| 亚洲精品偷拍视频免费观看| 国产亚洲精彩视频| 无码天堂亚洲国产AV| 亚洲成AV人片高潮喷水| 亚洲乱码av中文一区二区| 精品亚洲456在线播放| 亚洲一级免费毛片| 亚洲婷婷第一狠人综合精品| 亚洲国产精品无码久久久| 亚洲精品视频免费看| 亚洲一区影音先锋色资源| 久久久综合亚洲色一区二区三区| 亚洲中文字幕无码久久综合网| 亚洲麻豆精品国偷自产在线91| 一本久久综合亚洲鲁鲁五月天 | 亚洲精品乱码久久久久久蜜桃| 国产高清免费的视频| 日本特黄特黄刺激大片免费| 日韩精品视频免费在线观看| 日本免费网站观看| 亚洲国产综合精品中文字幕| 国产精品xxxx国产喷水亚洲国产精品无码久久一区 | 亚洲午夜久久久精品影院| 亚洲午夜视频在线观看| 亚洲的天堂av无码| 亚洲一区二区三区久久| 亚洲一区二区三区在线观看网站| 亚洲乱人伦中文字幕无码| www亚洲精品久久久乳|