Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Hibernate3²Ù×÷OracleµÄBlob×Ö¶Î

hibernate×÷Ϊһ¸öÓÅÐãµÄOR£­Mapping¹¹¼Ü£¬¶ÔÊý¾Ý¿âµÄ»ù±¾²Ù×÷½øÐÐÁ˱ȽϺõķâ×°£¬Õë¶ÔBlobÀàÐÍ×ֶεIJÙ×÷Ò²²»ÀýÍâ¡£µ«ÍøÉϴ󲿷ÖÄÜÕÒµ½µÄhibernate²Ù×÷BlobµÄÀý³Ì¶¼ÊÇ»ùÓÚhibernate2°æ±¾µÄ£¬Í¬Ê±ÔÚʵ¼Ê²Ù×÷ÖÐÎÒ·¢ÏÖÕë¶Ô²»Í¬µÄÊý¾Ý¿â£¬¿ÉÒÔÓв»Í¬µÄ²Ù×÷·½·¨¡£ÏÂÃ潫hibernate3²Ù×÷oracleµÄBlob×ֶνøÐÐÒ»¸ö½éÉÜ¡£
         ÓÃJDBC²Ù×÷Blob×î»ù±¾µÄ˼·ÊÇ£ºÏȲåÈëÒ»Ìõ°üº¬¿ÕBlobµÄ¼Ç¼£¬È»ºóÁ¢¼´½«¸ÃÌõ¼Ç¼ÓÃÐÐËø¶¨µÄ·½Ê½´ò¿ª£¬µÃµ½¸ÄBlob×ֶεÄÒýÓ㬴ÓÖеõ½Ò»¸öÊä³öÁ÷£¬½«byte[]Êý¾ÝдÈëºóÌá½»¡£hibernate²Ù×÷µÄ»ù±¾Ë¼Â·Ò²ÊÇÒ»Öµġ£ÏÂÀýÖÐÓõ½±íimg£¬ÀïÃæÒ»¸öÖ÷¼üid£¬Ò»¸öBlob×Ö¶Îimg¡£Ëü¶ÔÓ¦µÄÓ³ÉäÎļþÈçÏ£º
  
      <class name="Img" table="IMG">
          <id name="id" column="ID" type="long">
              <generator class="increment"/>
          </id>
          <property name="img" column="IMG" type="java.sql.Blob" />        1
      </class>
         ÔÚ1´¦¿ÉÒÔ²»Ö¸¶¨×ֶεÄÀàÐÍ£¬ÈÃhibernate×Ô¶¯´¦Àí¡£¶ÔÓ¦µÄ³Ö¾Ã»¯ÀàÖУ¬imgÊôÐÔÒ²ÉùÃ÷Ϊjava.sql.BlobÀàÐÍ¡£²åÈëµÄ´úÂëÈçÏ£º
  
    Session s = Hsf.currentSession();
    Transaction t = s.beginTransaction();
    Img img = new Img();
  //µ÷ÓÃHibernateµÄ¾²Ì¬·½·¨£¬´´½¨Ò»¸ö³¤¶ÈΪ1µÄbyteÊý×飬Éú³ÉÒ»¸ö¿ÕBlob
    img.setImg(Hibernate.createBlob(new byte[1]));
    s.save(img);  //±£´æµ½Êý¾Ý¿âÖÐ
    s.flush();
    s.refresh(img,LockMode.UPGRADE);  //Ëø¶¨Îª¸üÐÂģʽ
    //System.out.println(img.getImg().getClass());
  //·µ»ØµÄÊÇSerializableBlobÀàÐ͵ĶÔÏó£¬ÕâÊǸöʵÏÖÁËBlob½Ó¿ÚµÄ¶Ô


Ïà¹ØÎĵµ£º

Oracle¶àÐмǼºÏ²¢/Á¬½Ó/¾ÛºÏ×Ö·û´®µÄ¼¸ÖÖ·½·¨

ʲôÊǺϲ¢¶àÐÐ×Ö·û´®£¨Á¬½Ó×Ö·û´®£©ÄØ£¬ÀýÈ磺
SQL> desc test;
Name     Type          Nullable Default Comments
------- ------------ -------- ------- --------
COUNTRY VARCHAR2(20) Y       &nb ......

Oracle Êý¾ÝÀàÐÍ·ÖÏí

¸øÍŶÓÄÚ²¿×öµÄÒ»¸öOracle Êý¾ÝÀàÐÍ·ÖÏí£¬Ö÷ÒªÊǹØÓÚOracleÊý¾ÝÀàÐÍһЩÄÚ²¿´æ´¢½á¹¹¼°ÐÔÄܽéÉÜ¡£
 http://www.slideshare.net/yzsind/oracle-4317768
ÒÔÏÂÊÇPPTÖÐunDumpNumberº¯ÊýµÄÈ«²¿´úÂ룺
 
create or replace function unDumpNumber(iDumpStr varchar2) return number is
 
  TYPE ByteAr ......

¹ØÓÚOracleÊý¾Ýµ¼Èëµ¼³öµÄһЩ²Ù×÷

OracleÊý¾Ýµ¼Èëµ¼³öimp/exp¾ÍÏ൱ÓÚoracleÊý¾Ý»¹Ô­Ó뱸·Ý¡£expÃüÁî¿ÉÒÔ°ÑÊý¾Ý´ÓÔ¶³ÌÊý¾Ý¿â·þÎñÆ÷µ¼³öµ½±¾µØµÄdmpÎļþ£¬impÃüÁî¿ÉÒÔ°ÑdmpÎļþ´Ó±¾µØµ¼Èëµ½Ô¶´¦µÄÊý¾Ý¿â·þÎñÆ÷ÖС£ ÀûÓÃÕâ¸ö¹¦ÄÜ¿ÉÒÔ¹¹½¨Á½¸öÏàͬµÄÊý¾Ý¿â£¬Ò»¸öÓÃÀ´²âÊÔ£¬Ò»¸öÓÃÀ´ÕýʽʹÓá£
 
Ö´Ðл·¾³£º¿ÉÒÔÔÚSQLPLUS.EXE»òÕßDOS£¨ÃüÁîÐУ©ÖÐÖ´ÐУ¬ ......

Oracle select in/exists/not in/not exits

in ÊÇ°ÑÍâ±íºÍÄÚ±í×÷hash Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ­»·£¬Ã¿´ÎloopÑ­»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö±ÒÔÀ´ÈÏΪexists±ÈinЧÂʸߵÄ˵·¨ÊDz»×¼È·µÄ¡£
Èç¹û²éѯµÄÁ½¸ö±í´óСÏ൱£¬ÄÇôÓÃinºÍexists²î±ð²»´ó¡£
in ÊÇ°ÑÍâ±íºÍÄÚ±í×÷hash Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ­»·£¬Ã¿´ÎloopÑ­»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö ......

´øÅÅÐòµÄoracle·ÖÒ³´æ´¢¹ý³Ì

create or replace package Pager
is
type curs is ref cursor;
procedure Pagination
(
inPageSize in integer, --ÿҳ¼Ç¼Êý
inPageIndex in integer, --µ±Ç°Ò³Êý
inTableName in varchar2, --±íÃû
inOrderField in varchar2,--ÅÅÐò×Ö¶Î
inIsOrderBy in varchar2,--ÅÅÐòÀà±ð£¬ÊäÈë'  desc' »òÕß' asc'
inW ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ