µ±Ç°Î»ÖãºÆßµÀÆæ ¡ú ÎÄÕÂ×ÊѶ ¡ú ±à³Ì¼¼Êõ ¡ú Java±à³Ì
ÈÕÆÚ£º2011-03-22 16:13:00  À´Ô´£º±¾Õ¾ÕûÀí

ϵͳѧϰhibernateÖ®Ò»:²Ù×÷hibernateÖеÄSchemaExportÉú³ÉÊý¾Ý[Java±à³Ì]

ÔÞÖúÉÌÁ´½Ó



¡¡¡¡±¾ÎÄ¡°ÏµÍ³Ñ§Ï°hibernateÖ®Ò»:²Ù×÷hibernateÖеÄSchemaExportÉú³ÉÊý¾Ý[Java±à³Ì]¡±ÊÇÓÉÆßµÀÆæΪÄú¾«ÐÄÊÕ¼¯£¬À´Ô´ÓÚÍøÂçתÔØ£¬ÎÄÕ°æȨ¹éÎÄÕÂ×÷ÕßËùÓУ¬±¾Õ¾²»¶ÔÆä¹ÛµãÒÔ¼°ÄÚÈÝ×öÈκÎÆÀ¼Û£¬Çë¶ÁÕß×ÔÐÐÅжϣ¬ÒÔÏÂÊÇÆä¾ßÌåÄÚÈÝ£º

ÓÉÓÚhibernate3¹©Ó¦ÁË×Ô´øµÄ¹¤¾ßhbm2ddl,³ÉÁ¢°´ÕÕÄãµÄ¶ÔÏó³ÉÁ¢Êý¾Ý¿âÊÇÒ»¼þ·Ç³£¼òµ¥µÄÊÂÇé.

Demo¹¹ÔìͼÒÔÏÂ:

1¡¢Ê×ÏȳÉÁ¢POJOÀà

1package org.apple.hibernate;
2
3public class User {
4¡¡¡¡private String id;
5¡¡¡¡private String name;
6¡¡¡¡private String password;
7¡¡¡¡public String getId() {
8¡¡¡¡¡¡¡¡return id;
9¡¡¡¡}
10¡¡¡¡public void setId(String id) {
11¡¡¡¡¡¡¡¡this.id = id;
12¡¡¡¡}
13¡¡¡¡public String getName() {
14¡¡¡¡¡¡¡¡return name;
15¡¡¡¡}
16¡¡¡¡public void setName(String name) {
17¡¡¡¡¡¡¡¡this.name = name;
18¡¡¡¡}
19¡¡¡¡public String getPassword() {
20¡¡¡¡¡¡¡¡return password;
21¡¡¡¡}
22¡¡¡¡public void setPassword(String password) {
23¡¡¡¡¡¡¡¡this.password = password;
24¡¡¡¡}
25
26}

2¡¢°´ÕÕPOJOÀàÀïÃæÀïÃæÏà¹ØµÄ×Ö¶ÎдUser.hbm.xmlÓ³ÉäÎļþ

1<?xml version="1.0" encoding="GB2312"?>
2<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
3<hibernate-mapping>
4¡¡¡¡<class name="org.apple.hibernate.User">
5¡¡¡¡¡¡¡¡<!--hibernateΪÎÒÃÇÉú³ÉÖ÷¼üid-->
6¡¡¡¡¡¡¡¡<id name = "id" unsaved-value = "null">
7¡¡¡¡¡¡¡¡¡¡¡¡<generator class="uuid.hex"/>
8¡¡¡¡¡¡¡¡</id>
9
10¡¡¡¡¡¡¡¡<!--ĬÐí°ÑÀàµÄ±äÁ¿Ó³ÉäΪÏàͬÃû×ֵıíÁÐ,µ±È»ÎÒÃÇ¿ÉÒÔ¸ÄÕýÆäÓ³Éä·½·¨-->
11¡¡¡¡¡¡¡¡<property name="name"/>
12¡¡¡¡¡¡¡¡<property name="password"/>
13¡¡¡¡</class>
14</hibernate-mapping>


¡¡¡¡ÒÔÉÏÊÇ¡°ÏµÍ³Ñ§Ï°hibernateÖ®Ò»:²Ù×÷hibernateÖеÄSchemaExportÉú³ÉÊý¾Ý[Java±à³Ì]¡±µÄÄÚÈÝ£¬Èç¹ûÄã¶ÔÒÔÉϸÃÎÄÕÂÄÚÈݸÐÐËȤ£¬Äã¿ÉÒÔ¿´¿´ÆßµÀÆæΪÄúÍƼöÒÔÏÂÎÄÕ£º

  • ϵͳѧϰhibernateÖ®Ò»:²Ù×÷hibernateÖеÄSchemaExportÉú³ÉÊý¾Ý
  • ϵͳѧϰhibernateÖ®¶þ SessionÖÐloadºÍget
  • <b>ϵͳѧϰhibernateÖ®Èý transient¡¢persistent¡¢detachedÇé¿ö</b>
  • ϵͳѧϰhibernateÖ®ËÄ hibernate¶à¶ÔÒ»¹ØÁªÓ³Éä
  • ±¾ÎĵØÖ·£º ÓëÄúµÄQQ/BBSºÃÓÑ·ÖÏí!
    • ºÃµÄÆÀ¼Û¡¡Èç¹ûÄú¾õµÃ´ËÎÄպ㬾ÍÇëÄú
        0%(0)
    • ²îµÄÆÀ¼Û¡¡Èç¹ûÄú¾õµÃ´ËÎÄÕ²¾ÍÇëÄú
        0%(0)

    ÎÄÕÂÆÀÂÛÆÀÂÛÄÚÈÝÖ»´ú±íÍøÓѹ۵㣬Óë±¾Õ¾Á¢³¡Î޹أ¡

       ÆÀÂÛÕªÒª(¹² 0 Ìõ£¬µÃ·Ö 0 ·Ö£¬Æ½¾ù 0 ·Ö) ²é¿´ÍêÕûÆÀÂÛ
    Copyright © 2020-2022 www.xiamiku.com. All Rights Reserved .