Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.8k views
in Technique[技术] by (71.8m points)

hibernate用SQLQuery如何向数据库中插入clob大文本?

代码如下,通过`
query.setParameter(i, Hibernate.createClob(formValue.get(params[i])));
并不行,不能插入大文本

SQLQuery query = null;
String params[] =sqlSources.get(paramID).split(",");

query = jbpmContext.getSession().createSQLQuery(sqlSources.get(sqlID));

        for(int i=0,len = params.length; i<len; i++){

                //log.info(params[i] +":===:"+formValue.get(params[i]));
                
                if (params[i].equals("CF_CONTENT")) {
                
                    query.setParameter(i, Hibernate.createClob(formValue.get(params[i])));
                    
                }else {
                    query.setString(i, formValue.get(params[i]));
                    
                    
                }
                
            }
        }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...