¿ìËÙÒµÎñͨµÀ

Struts´¦·½ - HibernateÓëStruts - ±à³ÌÈëÃÅÍø

×÷Õß ØýÃû¼¼Êõ À´Ô´ NET±à³Ì ä¯ÀÀ ·¢²¼Ê±¼ä 2012-06-17

Struts´¦·½ - HibernateÓëStruts

ʱ¼ä:2011-04-09

³Ö¾Ã²ãÊÇÒ»¸öÓ¦ÓÃϵͳ×î»ù±¾µÄ²¿·Ý¡£ºÜÏÔÈ»µÄ£¬Èç¹ûûÓг־ò㣬ËùÓеŤ×÷¶¼½«¶ªÊ§ ¡£µ«ÊÇ£¬¶Ô²»Í¬µÄÈËÀ´Ëµ³Ö¾Ã²ãÒâζ×Ų»Í¬µÄ¶«Î÷¡£³Ö¾Ã»¯Ê±¼äµÄ³¤¶ÌÊÇÑ¡Ôñ³Ö¾Ã²ã´¢´æý ½éµÄ»ù±¾ºâÁ¿±ê×¼Ö®Ò»¡£ÀýÈ磬¶ÔÓÚÉúÃüÖÜÆÚΪһ¸öÓû§»á»°µÄÊý¾ÝÀ´Ëµ£¬Http sessionÊÇ ·Ç³£ºÏÊʵġ£ÓëÖ®¶ÔÓ¦µÄ£¬¿çÔ½¶à¸ösession£¬»òÕ߶à¸öÓû§µÄ³Ö¾Ã»¯ÔòÐèÒªÒ»¸öÊý¾Ý¿âÀ´±£ ³Ö¡£Êý¾ÝµÄÊýÁ¿ÊÇÁíÒ»¸ö·Ç³£ÖØÒªµÄºâÁ¿±ê×¼¡£ÀýÈ磬×î¼Ñʵ¼ù±íÃ÷´óÁ¿µÄÊý¾Ý×îºÃ²»Òª±» ´æ´¢ÔÚÒ»¸öHttp»á»°ÖС£ÔÚÕâЩÇé¿öÏ£¬Ä㶼Ӧ¸Ã¿¼ÂÇʹÓÃÊý¾Ý¿â¡£ÔÚÕâƪÎÄÕÂÖУ¬ÎÒÃÇµÄ Ä¿±ê¾ÍÊÇÊý¾Ý¿â³Ö¾Ã²ã¡£

ÄãÑ¡ÔñµÄÊý¾Ý¿âÀàÐͶÔÄãÓмܹ¹ÓëÉè¼Æ¶¼ÓÐÖØÒªµÄÓ°Ïì¡£×÷ΪÃæÏò¶ÔÏóµÄ¿ª·¢ÈËÔ±£¬ÎÒÃÇ ÇãÏòÓÚ°ÑÊý¾ÝÃè»æ³ÉÃèÊöÊÖÉÏÉÌÒµÎÊÌâµÄÒ»×éÏ໥¹ØÁªµÄ¶ÔÏó—Õâ³£±»³ÆΪÓòÄ£ÐÍ¡£ µ«ÊÇ£¬ ×î³£ÓõĴ洢ý½éÊÇ»ùÓÚ¹ØϵģÐ͵ġ£³ý·ÇÎÒÃǵĶÔÏóÄ£ÐÍÓ³Éä³ÉÒ»¸ö¹Øϵ½á¹¹£¬·ñÔòÄÚ´æ ÖÐÎÒÃÇÊý¾ÝµÄ±íʾ¾Í»áÓë³Ö¾Ã»¯ËüµÄ·½·¨²»Ò»Ö¡£Õâ¸öÎÊÌâÒ²±»³Æ×÷²»¶Ô³ÆÎÊÌâ¡£×îÁ÷ÐÐµÄ ½â¾öÕâÖÖ²»¶Ô³ÆÎÊÌâµÄÊÇÒ»×é±»³ÆΪ¶ÔÏó¹ØϵӳÉ乤¾ß¡£Ò»¸öORM¹¤¾ßÊDZ»ÓÃÀ´°ÑÊý¾Ý´Ó¶ÔÏó ÊÓͼת»»Îª¹ØϵÐÍ¡¢ÌṩÖîÈç´´½¨¡¢¶Á¡¢¸üС¢É¾³ý(CRUD)µÈ³Ö¾ÃÐÔ·þÎñµÄÈí¼þ¡£ÓÐÐí¶àµÄ ¹ØÓÚORM¹¤¾ßµÄÂÛÎÄ£¬µ«ÊÇ´Ó±¾ÖÊÉÏÀ´Ëµ£¬ËûÃÇ̸Â۵Ķ¼ÊǶÔÏóÓ³Éäģʽ¡£×îÁ÷ÐеÄORM¹¤¾ß ÊÇ¿ªÔ´µÄHibernate¹¤³Ì¡£

ÔÚÕâƪÎÄÕÂÖУ¬ÎÒÃÇչʾÁËÈçºÎÔÚÒ»¸öStrutsÏîÄ¿ÖÐÓ¦ÓÃHibernate¡£ÁíÍ⣬ÎÒÃǽ«Õ¹Ê¾ ÈçºÎ½¨Á¢Ò»¸öStruts²å¼þÀ´ÌáÉýÄãϵͳµÄÐÔÄÜ¡£

´¦·½

ÔÚÕâ¸öÎÄÕªÖУ¬ÎÒÃÇʹÓÃÒ»¸öÀý×ÓÀ´Õ¹Ê¾ÄãÔÚstrutsÏîÄ¿ÖÐʹÓÃhibernateʱËùÐèÒªµÄËù Óж«Î÷¡£ÎÒÃǽ«½¨Á¢Ò»¸öÓ¦ÓóÌÐòÀ´»ñÈ¡ºÍչʾ´Ó»¯Ñ§ÔªËØÖÜÆÚ±íÀïÈ¡³öµÄÔªËØ¡£Õâ¸öÓ¦Óà ³Ì

ÐòÌṩ¸øÓû§Ò»¸ö²éÕÒÒ³À´Í¨¹ýÔªËØ·ûºÅÀ´²éÕÒÔªËØ¡£Ó¦ÓóÌÐò½«²éѯÊý¾Ý¿âÀïÆ¥ÅäÕâ¸ö ÔªËØ·ûºÅÃûµÄ¼Ç¼²¢·µ»Ø²éÕÒµ½µÄÔªËØÐÅÏ¢À´ÏìÓ¦Óû§ÇëÇó¡£

Ê×ÏÈÎÒÃǽ«Õ¹Ê¾ÈçºÎÆô¶¯Hypersonic·þÎñÆ÷¡£µ±Êý¾Ý¿â·þÎñÆ÷Æô¶¯ºó£¬ÎÒÃǽ¨Á¢Ê¾Àý³ÌÐò ËùÐèÒªµÄ±íÓëÊý¾Ý¡£Ò»µ©Êý¾Ý¿â×¼±¸ÔËÐÐÁË£¬ÎÒÃǽ«½¨Á¢Ê¹ÓÃHypersonicÊý¾Ý¿â·þÎñÆ÷ËùÐè µÄHibernateµÄËùÓж«Î÷¡£½ÓÏÂÀ´µÄ²½ÖèÊÇÔÚactionÀïµ÷ÓÃHibernateÀ´´¦ÀíÊý¾Ý¿â¶ÁÈ¡À´Ïì Ó¦²éѯÇëÇó¡£ÒòΪ½¨Á¢HibernateµÄFactory¶ÔÏóÊǷdz£ºÄ×ÊÔ´µÄ£¬ÎÒÃǽ¨Á¢Ò»¸öStruts plug-inÀ´½¨Á¢factory²¢°ÑËü±£´æÔÚcontextÀï¡£

ÈÃÎÒÃÇ´Ó½¨Á¢HypersonicÊý¾Ý¿â·þÎñÆ÷¿ªÊ¼¡£ÄãÐèÒª´Óhttp://hsqldb.Sourceforge.net/ ÏÂÔØËü¡£·ÅÖÃhsqldb.jarÔÚÄãµÄclasspath·¾¶À´ÓDos´°¿ÚÖÐÇÃÈëÒÔÏÂÃüÁîÀ´Æô¶¯ Hypersonic:

java org.hsqldb.Server

ËäÈ»²»Í¬°æ±¾µÄHypersonicµÄ·þÎñÆ÷ÏìÓ¦²»Í¬¡£ÏÂÃæµÄÓ¦´ðÊǵäÐ͵ÄHypersonicÒѾ­×¼±¸ ºÃÏìÓ¦Êý¾Ý¿âÇëÇóµÄÓ¦´ð£º

Server 1.6 is running

Press [Ctrl]+{c} to abort

Ëæ×ÅÊý¾Ý¿â·þÎñÆ÷µÄÆô¶¯£¬ÎÒÃÇ¿ÉÒÔ½¨±íºÍÌî³äÊý¾Ý£¬ÈçÏÂÁбí1Ëùʾ£º

Listing 1. ½¨Á¢ÔªËرí

create table elements (id integer(3) IDENTITY, ¡¡¡¡ name char(30), ¡¡¡¡ number char(30), ¡¡¡¡ mass char(30), ¡¡¡¡ symbol char(2)); ¡¡¡¡ CREATE UNIQUE INDEX ui_elements_pk ON elements (symbol)insert into elements ( name, number, mass, symbol) values (''Manganese'',''25'',''55'',''Mn'');insert into elements ( name, number, mass, symbol) values (''Zinc'',''30'',''65'',''Zn'');insert into elements ( name, number, mass, symbol) values (''Thulium'',''69'',''169'',''Tm'');insert into elements ( name, number, mass, symbol) values (''Californium'',''98'',''251'',''Cf'');insert into elements ( name, number, mass, symbol) valu

ÁèÖڿƼ¼×¨ÒµÌṩ·þÎñÆ÷×âÓᢷþÎñÆ÷Íйܡ¢ÆóÒµÓʾ֡¢ÐéÄâÖ÷»úµÈ·þÎñ£¬¹«Ë¾ÍøÕ¾£ºhttp://www.lingzhong.cn ΪÁ˸ø¹ã´ó¿Í»§Á˽â¸ü¶àµÄ¼¼ÊõÐÅÏ¢£¬±¾¼¼ÊõÎÄÕÂÊÕ¼¯À´Ô´ÓÚÍøÂç,ÁèÖڿƼ¼×ðÖØÎÄÕÂ×÷ÕߵİæȨ£¬Èç¹ûÓÐÉæ¼°ÄãµÄ°æȨÓбØҪɾ³ýÄãµÄÎÄÕ£¬ÇëºÍÎÒÃÇÁªÏµ¡£ÒÔÉÏÐÅÏ¢ÓëÎÄÕÂÕýÎÄÊDz»¿É·Ö¸îµÄÒ»²¿·Ö,Èç¹ûÄúҪתÔر¾ÎÄÕÂ,Çë±£ÁôÒÔÉÏÐÅÏ¢£¬Ð»Ð»!

·ÖÏíµ½£º ¸ü¶à

Copyright ©1999-2011 ÏÃÃÅÁèÖڿƼ¼ÓÐÏÞ¹«Ë¾ ÏÃÃÅÓÅͨ»¥Áª¿Æ¼¼¿ª·¢ÓÐÏÞ¹«Ë¾ All rights reserved

µØÖ·(ADD)£ºÏÃÃÅÈí¼þÔ°¶þÆÚÍûº£Â·63ºÅ701E£¨¶«ÄÏÈÚͨÅÔ£© Óʱà(ZIP)£º361008

µç»°£º0592-5908028 ´«Õ棺0592-5908039 ×ÉѯÐÅÏ䣺web@lingzhong.cn ×ÉѯOICQ£º173723134

¡¶ÖлªÈËÃñ¹²ºÍ¹úÔöÖµµçÐÅÒµÎñ¾­ÓªÐí¿ÉÖ¤¡·ÃöB2-20100024  ICP±¸°¸:ÃöICP±¸05037997ºÅ