ϵͳѧϰ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±à³Ì]¡±µÄÄÚÈÝ£¬Èç¹ûÄã¶ÔÒÔÉϸÃÎÄÕÂÄÚÈݸÐÐËȤ£¬Äã¿ÉÒÔ¿´¿´ÆßµÀÆæΪÄúÍƼöÒÔÏÂÎÄÕ£º
±¾ÎĵØÖ·£º | ÓëÄúµÄQQ/BBSºÃÓÑ·ÖÏí! |