ÔÚhibernateÖÐʵÏÖoracleµÄÖ÷¼ü×ÔÔö²ßÂÔ
ת×Ô£ºhttp://blog.csdn.net/scorpio3k/archive/2009/05/09/4162079.aspx
ÔںܶàÇé¿öÏ£¬ÎÒÃÇʹÓÃHibernateÔÚÒѾ½¨Á¢ºÃÊý¾Ý¿âµÄ»ù´¡ÉÏ¡£ÔÚoracleÖУ¬Èç¹ûÒѾ½¨Á¢ºÃµÄÊý¾Ý¿âÖÐʹÓÃÁËsequence
,Ôò¿ÉÒÔ°´ÕÕÏÂÃæµÄ²½Öè°ÑËüÒýÈëµ½HibernateÖУº
1¡¢ÔÚoracle Ê×ÏÈ´´½¨sequence
create sequence seq_id
minvalue 1
start with 1
increment by 1
cache 20;
2.ÔÚÄãµÄhbm.xmlÖеÄÅäÖÃ
<id column="ID0000" name="id" type="integer">
<generator class="sequence">
<param name="sequence">seq_id</param>
</generator>
</id>
ÕâÑùÔÙ²åÈëÊý¾ÝµÄʱºò£¬Hibernate»Ø×Ô¶¯Éú³ÉÈçÏÂÓï¾ä£º
hibernate
: select seq_id.nextval from dual
hibernate
: insert into YXJK.T_YXJK_WHRYTXL (XM0000, ZW0000, LXDH00, SJHM00, DZYJ00,
IP0000, ID0000) values (?, ?, ?, ?, ?, ?, ?)
×Ô¶¯Éú³ÉÏÂÒ»¸öÐòÁÐÖµ£¬È»ºó½«¶ÔÏó²åÈë±íÖС£
ÔÚʹÓõÄʱºòÐèҪעÒ⣬Hibernate¶ÔÓÚsequenceµÄÖ÷¼üµÄÒªÇóÊÇÒ»¶¨ÒªÊÇshor,long£¬»òÕßinteger
¸ù¾ÝhibernateµÄÎĵµ£¬ÓÐÁ½ÖÖ·½Ê½ÊµÏÖʵÌå¶ÔÏóµÄÖ÷¼ü×Ô¶¯Ôö³¤¡£
µÚÒ»ÖÖ£ºÉèÖÃIDµÄÔö³¤²ßÂÔÊÇsequence£¬Í¬Ê±Ö¸¶¨sequenceµÄÃû×Ö£¬×îºÃÿ¸ö±í½¨Ò»¸ösequence£¬´ËÖÖ×ö·¨¾ÍÈçͬMS-SQL,MY-SQLÖеÄ×Ô¶¯Ôö³¤Ò»Ñù£¬²»ÐèÒª´´½¨´¥·¢Æ÷£¬¾ßÌåµÄoracleÊý¾Ý¿â½Å±¾¼°hibernateÅäÖÃÎļþÈçÏ£º
[1]or
Ïà¹ØÎĵµ£º
Õª×Ô¡¶½âÎöoracleµÄrownum¡·×÷Õߣºchen_liang
¶ÔÓÚrownumÀ´ËµËüÊÇoracleϵͳ˳Ðò·ÖÅäΪ´Ó²éѯ·µ»ØµÄÐеıàºÅ£¬·µ»ØµÄµÚÒ»ÐзÖÅäµÄÊÇ1£¬µÚ¶þÐÐÊÇ2£¬ÒÀ´ËÀàÍÆ£¬Õâ¸öα×ֶοÉÒÔÓÃÓÚÏÞÖƲéѯ·µ»ØµÄ×ÜÐÐÊý£¬ÇÒrownum²»ÄÜÒÔÈκαíµÄÃû³Æ×÷Ϊǰ׺¡£
(1) rownum ¶ÔÓÚµÈÓÚijֵµÄ²éѯÌõ¼þ
Èç¹ûÏ£ÍûÕÒµ½Ñ§Éú±íÖеÚÒ»ÌõѧÉúµÄÐÅÏ¢ ......
£±£º´´½¨»·¾³±äÁ¿
¡¡¡¡export $ORACLE_HOME $ORACLE_SID£¨×¼±¸½¨Á¢µÄÊý¾Ý¿âµÄSID)
£²£º½¨Á¢³õʼ»¯²ÎÊýÎļþ
¡¡¡¡$ORACLE_HOME/dbs/init$ORACLE_SID.ora (¿ÉÒÔ´ÓÒѾ½¨ºÃµÄ¿âÀïÃæÄÃ,ͨ³£ÔÚpfile ÀïÃ棩,Ò²¿ÉÒÔ×Ô¼º½¨£º
¡¡¡¡control_files = ($ORACLE_HOME/oradata/$ORACLE_SID/control1.ctl,$ORACLE_HOME/oradata/$ORACLE ......
ÊÖÍ·ÕýÔÚ½øÐÐÒ»¸öÏîÄ¿£¬ÐèҪȫÎļìË÷£¬¾¹ýͬÊÂ×ÐϸËÑË÷·¢ÏÖ£ºoracleÌṩoracle textµÄÈ«ÎļìË÷¹¦ÄÜ¡£
oracle textµÄ¼òµ¥Ó¦ÓþͬʲâÊÔ½á¹ûÕý³££¬°´ÕÕÏîÄ¿ÒªÇó(ÏîÄ¿Ô¤¶¨·½°¸wordÎĵµ´æÈëÊý¾Ý¿â(blobÀàÐÍ))ʹÓÃoracle text²éѯ½á¹ûÈ·ÊÇΪ¿Õ£¬Í¬ÊÂÑо¿µ½´ËÖжϡ£
  ......
ÔÚSQLÓï¾äÓÅ»¯¹ý³ÌÖУ¬¾³£»áÓõ½hint,
ÒÔÏÂÊÇÔÚSQLÓÅ»¯¹ý³ÌÖг£¼ûOracleÖÐ"HINT"µÄ30¸öÓ÷¨1. /*+ALL_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ»ùÓÚ¿ªÏúµÄÓÅ»¯·½·¨,²¢»ñµÃ×î¼ÑÍÌÍÂÁ¿,ʹ×ÊÔ´ÏûºÄ×îС»¯.
ÀýÈç:
SELECT /*+ALL+_ROWS*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO='SCOTT';
2. /*+FIRST_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ ......
Oracle,MySQL,MSSQL ServerºÍAccessÊý¾Ý¿âµÄͳ¼Æº¯Êý
ÎÒÃÇÔÚ±à³ÌÖг£ÓõÄͳ¼Æº¯ÊýÓмÆÊý,ÇóºÍ,Çó×î´óÖµ,Çó×îСֵ,Çóƽ¾ù,·½²îºÍ±ê×¼²î.
·½²î(Variance)
·½²îÊDZê׼ƫ²îµÄƽ·½¡£×éÖеÄÖµ£¬ÓëËüÃÇƽ¾ùÖµÖ®¼äÆ«Àë³Ì¶ÈµÄ¶ÈÁ¿¡£
±ê׼ƫ²î(Standard Deviation)
Ò»¸ö²ÎÊý£¬Ö¸³öÒ»ÖÖ·½Ê½£¬Ò»¸ö¸ÅÂʺ¯ÊýÒÔÕâÖÖ·½Ê½·Ö²¼ÔÚƽ¾ùÖµ¸ ......