Õ¾ÄÚËÑË÷: ÇëÊäÈëËÑË÷¹Ø¼ü´Ê

µ±Ç°Ò³Ãæ: ¿ª·¢×ÊÁÏÊ×Ò³ ¡ú J2SE רÌâ ¡ú ·ÖÏí¸ã¶¨µÄ CLOB ×ֶδæÈ¡µÄ´úÂë

·ÖÏí¸ã¶¨µÄ CLOB ×ֶδæÈ¡µÄ´úÂë

ÕªÒª: ·ÖÏí¸ã¶¨µÄ CLOB ×ֶδæÈ¡µÄ´úÂë
<table cellSpacing=0 cellPadding=0 border=0 class="zh114" align="right"> <tr> <td > </td> </tr> </table>
¡¡¡¡²ÉÓõÃÊÇORACLE9iÊý¾Ý¿â£¬Jboss»òWeblogic¡£
¡¡¡¡JDBC²ÉÓÃORACLE9i×Ô´øµÄClass12.jar
¡¡¡¡£­£­£­£­£­£­£­£­£­£­£­£­£­
¡¡¡¡Êý¾Ý¿â½á¹¹£º
¡¡¡¡´úÂë:
¡¡¡¡
¡¡¡¡CREATE TABLE SNCPARAMETERS
¡¡¡¡(
¡¡¡¡¡¡ID¡¡¡¡ NUMBER(19)¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ NOT NULL,
¡¡¡¡¡¡SNCID¡¡NUMBER(19),
¡¡¡¡¡¡NAME¡¡ VARCHAR2(255),
¡¡¡¡¡¡VALUE¡¡CLOB
¡¡¡¡)
¡¡¡¡ £­£­£­£­£­£­£­£­£­£­£­£­£­£­
¡¡¡¡BO²ÉÓÃxdoclet½¨Á¢µÄ£º
¡¡¡¡´úÂë:
¡¡¡¡
¡¡¡¡public class SNCParameters extends BaseObject
¡¡¡¡{
¡¡¡¡
¡¡¡¡¡¡¡¡/**
¡¡¡¡¡¡¡¡ * Returns the id.
¡¡¡¡¡¡¡¡ *
¡¡¡¡¡¡¡¡ * @return¡¡¡¡¡¡long
¡¡¡¡¡¡¡¡ * @hibernate.id
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡column = "id"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡type = "long"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡generator-class = "native"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡unsaved-value = "null"
¡¡¡¡¡¡¡¡ */
¡¡¡¡¡¡¡¡public Long getId()
¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡return id;
¡¡¡¡¡¡¡¡}
¡¡¡¡
¡¡¡¡¡¡¡¡/**
¡¡¡¡¡¡¡¡ *¡¡¡¡Sets the Id attribute of the SNCParameters object
¡¡¡¡¡¡¡¡ *
¡¡¡¡¡¡¡¡ * @param¡¡¡¡id¡¡The new Id value
¡¡¡¡¡¡¡¡ */
¡¡¡¡¡¡¡¡public void setId(Long id)
¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡this.id = id;
¡¡¡¡¡¡¡¡}
¡¡¡¡
¡¡¡¡
¡¡¡¡¡¡¡¡/**
¡¡¡¡¡¡¡¡ * Returns the name.
¡¡¡¡¡¡¡¡ *
¡¡¡¡¡¡¡¡ * @return¡¡¡¡¡¡String
¡¡¡¡¡¡¡¡ *
¡¡¡¡¡¡¡¡ * @hibernate.property
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡column = "name"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡type = "string"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡not-null = "true"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡unique = "false"
¡¡¡¡¡¡¡¡ */
¡¡¡¡
¡¡¡¡¡¡¡¡public String getName()
¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡return name;
¡¡¡¡¡¡¡¡}
¡¡¡¡
¡¡¡¡¡¡¡¡/**
¡¡¡¡¡¡¡¡ *¡¡¡¡Sets the Name attribute of the SNCParameters object
¡¡¡¡¡¡¡¡ *
¡¡¡¡¡¡¡¡ * @param¡¡¡¡name¡¡The new Name value
¡¡¡¡¡¡¡¡ */
¡¡¡¡¡¡¡¡public void setName(String name)
¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡this.name = name;
¡¡¡¡¡¡¡¡}
¡¡¡¡
¡¡¡¡¡¡¡¡/**
¡¡¡¡¡¡¡¡ * Returns the sncId.
¡¡¡¡¡¡¡¡ *
¡¡¡¡¡¡¡¡ * @return¡¡¡¡¡¡Long
¡¡¡¡¡¡¡¡ *
¡¡¡¡¡¡¡¡ * @hibernate.property
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡column = "sncId"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡type = "long"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡not-null = "true"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡unique = "false"
¡¡¡¡¡¡¡¡ */
¡¡¡¡
¡¡¡¡¡¡¡¡public Long getSncId()
¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡return sncId;
¡¡¡¡¡¡¡¡}
¡¡¡¡
¡¡¡¡¡¡¡¡/**
¡¡¡¡¡¡¡¡ *¡¡¡¡Sets the SncId attribute of the SNCParameters object
¡¡¡¡¡¡¡¡ *
¡¡¡¡¡¡¡¡ * @param¡¡¡¡sncId¡¡The new SncId value
¡¡¡¡¡¡¡¡ */
¡¡¡¡¡¡¡¡public void setSncId(Long sncId)
¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡this.sncId = sncId;
¡¡¡¡¡¡¡¡}
¡¡¡¡
¡¡¡¡¡¡¡¡/**
¡¡¡¡¡¡¡¡ * Returns the values.
¡¡¡¡¡¡¡¡ *
¡¡¡¡¡¡¡¡ * @return¡¡¡¡¡¡Clob
¡¡¡¡¡¡¡¡ *
¡¡¡¡¡¡¡¡ * @hibernate.property
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡column = "value"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡type = "clob"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡not-null = "true"
¡¡¡¡¡¡¡¡ *¡¡¡¡¡¡¡¡¡¡unique = "false"
¡¡¡¡¡¡¡¡ */
¡¡¡¡
¡¡¡¡¡¡¡¡public Clob getValue()
¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡return value;
¡¡¡¡¡¡¡¡}
¡¡¡¡
¡¡¡¡¡¡¡¡/**
¡¡¡¡¡¡¡¡ *¡¡¡¡Sets the Values attribute of the SNCParameters object
¡¡¡¡¡¡¡¡ *
¡¡¡¡¡¡¡¡ * @param¡¡¡¡values¡¡The new Values value
¡¡¡¡¡¡¡¡ */
¡¡¡¡¡¡¡¡public void setValue(Clob value)
¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡this.value = value;
¡¡¡¡¡¡¡¡}
¡¡¡¡¡¡¡¡private Long id;
¡¡¡¡¡¡¡¡private Long sncId;
¡¡¡¡¡¡¡¡private String name;
¡¡¡¡¡¡¡¡private Clob value;
¡¡¡¡¡¡¡¡private String valueString;
¡¡¡¡¡¡¡¡public String getValueString()
¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡return valueString;
¡¡¡¡¡¡¡¡}
¡¡¡¡¡¡¡¡¡¡¡¡public void setValueString(String¡¡valueString)
¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡this.valueString = valueString;
¡¡¡¡¡¡¡¡}
¡¡¡¡}
¡¡¡¡
¡¡¡¡×¢£ºvalueString²¢²»Ó³Éäµ½Êý¾Ý¿âµÄCLOB×ֶΣ¬Ö»ÊÇ·½±ãÐèҪʹÓÃÕâ¸öBOµÄÈËÓÃGET¡¢SET ´¦ÀíÕâ¸ö¾Þ³¤µÄCLOB×Ö¶Î
¡¡¡¡£­£­£­£­£­£­£­£­£­£­£­£­
¡¡¡¡xdocLetÉú³ÉµÄXMLÎļþ£º
¡¡¡¡´úÂë:
¡¡¡¡
¡¡¡¡<?xml version="1.0"?>
¡¡¡¡
¡¡¡¡ hibernate-mapping PUBLIC
¡¡¡¡¡¡¡¡"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
¡¡¡¡¡¡¡¡"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
¡¡¡¡
¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡name="com.idncn.mc.bo.SNCParameters"
¡¡¡¡¡¡¡¡¡¡¡¡table="SNCParameters"
¡¡¡¡¡¡¡¡¡¡¡¡dynamic-update="false"
¡¡¡¡¡¡¡¡¡¡¡¡dynamic-insert="false"
¡¡¡¡¡¡¡¡>
¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡name="id"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡column="id"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡type="long"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡unsaved-value="null"
¡¡¡¡¡¡¡¡¡¡¡¡>
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡

¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡name="name"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡type="string"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡update="true"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡insert="true"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡column="name"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡not-null="true"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡unique="false"
¡¡¡¡¡¡¡¡¡¡¡¡/>
¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡name="sncId"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡type="long"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡update="true"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡insert="true"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡column="sncId"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡not-null="true"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡unique="false"
¡¡¡¡¡¡¡¡¡¡¡¡/>
¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡name="value"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡type="clob"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡update="true"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡insert="true"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡column="value"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡not-null="true"
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡unique="false"
¡¡¡¡¡¡¡¡¡¡¡¡/>
¡¡¡¡¡¡¡¡

¡¡¡¡
¡¡¡¡

¡¡¡¡
¡¡¡¡£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­£­
¡¡¡¡insertµÄ´úÂ룺
¡¡¡¡´úÂë:
¡¡¡¡
¡¡¡¡¡¡¡¡public List batchAddSncParameters(List sncParametersList, Long sncId) throws DbAccessException
¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡logger.enterMethod();
¡¡¡¡¡¡¡¡¡¡¡¡List ret = new ArrayList();
¡¡¡¡¡¡¡¡¡¡¡¡try
¡¡¡¡¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡sess = getSession();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡if (sncParametersList != null && sncParametersList.size() > 0)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡for (int i = 0; i < sncParametersList.size(); i++)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡SNCParameters cp = (SNCParameters) sncParametersList.get(i);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡long newId = -1;
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡if (cp != null)
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡SNCParameters cpNew = new SNCParameters();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡cpNew.setSncId(sncId);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡cpNew.setName(cp.getName());
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡cpNew.setValue(Hibernate.createClob(" "));
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡newId = ((Long) sess.save(cpNew)).longValue();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡sess.flush();
¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡ sess.refresh(cpNew, LockMode.UPGRADE);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡String content = cp.getValueString();
¡¡¡¡
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡String appserver = System.getProperty("appserver", "jboss");
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡if (!appserver.equalsIgnoreCase("jboss"))
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//weblogic
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡OracleThinClob clob = (OracleThinClob) cpNew.getValue();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡java.io.Writer pw = clob.getCharacterOutputStream();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡pw.write(content);
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡pw.flush();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡pw.close();
¡¡¡¡¡¡¡¡¡¡¡¡ }
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡else
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡{
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//jboss
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡oracle.sql.CLOB clob = (oracle.sql.CLOB) cpNew.getValue();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡java.io.Writer pw = clob.getCharacterOutputStream();
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡pw.write(content)

<table width="96%"> <tr> <td background="http:///images/dian.gif" height="3"></td> </tr> </table>

¡ü·µ»ØĿ¼
ǰһƪ: ÔÚ Java ³ÌÐòÉè¼ÆÖд¦Àí DOM Òì³£
ºóһƪ: ÎÞÐè JCE Óõײã API ʵÏÖ¿ª·¢ RSA