45fan.com - 路饭网

搜索: 您的位置主页 > 网络频道 > 阅读资讯:webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

2016-09-05 09:36:25 来源:www.45fan.com 【

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

一、项目背景

为某企业的工艺样版图实现信息化管理,方便对样版图所要进行的人工操作。


1) 带用户,密码登录;


2) 用户身份分级别, 不同身份的用户看不同的样办图;


3) 带搜索功能;


4) 点击样办图显示全图和属性;

二、系统环境


开发环境:Windows XP Eclipse3.1 JDK1.5 Tomcat5.5.17


系统架构:Webwork2.2.4+Freemarker-2.3.8+Hibernate-3.1.3


后台数据库:Mysql-5.0.13


第三方类库:webwork-2.2.4 log4j-1.2.8 hibernate-3.1.3 dwr-1.0 dom4j-1.6.1

mysql-connector-java-3.1.12-bin.jar fileupload-1.1.1 spring-1.2.6 freemarker-2.3.8

三、需求分析
实现用户对图片的浏览、上传、删除等操作,图片的显示可以分为:列表显示、缩略图显示、幻灯片显示,同时能详细显示某个图片的详细描述,上传时间,规格、大孝上传人等。系统管理员可以设置系统用户组,超级用户: 拥有所有功能添加, 删除, 修改 和浏览所有目录,受限用户: a. 可添加文件, 浏览指定目录b. 只可浏览指定目录文件,系统管理员可以对图片进行分类存储:A) 可以按日期分(09/07/2006);B) 可以按类型分(类型有: a) 电脑袋 b) 旅行包 c) 行李包 d) 公文包 e),创建目录名,同时指定该目录所属用户组。可以对图片文件按要求进行搜索:A) 可以按名称搜索 B) 可以按分类搜索 C) 搜索某时间段产品 ..... 搜索出来的产品可以以缩略图显示 D) 按用户搜索,搜索后显示该用户的所有图片

四、模块设计
分类管理


系统管理员可以增加、删除、编辑图片目录,同时更改图片目录的所属用户组
样版图管理


用户可以查询、上传图片到指定分类的目录路径,删除、编辑(只限管理员身份且具有相应权限)
用户管理


管理员可以增加、删除、编辑用户,指定用户所属用户组


用户组管理


管理员可以增加、删除、编辑用户组信息


系统回收站


存放待删除的图片文件或目录文件(只限管理员身份且具有相应权限)


我的样版图


同样版图管理相似,全部用户可使用,区别在于,只能查询和处理所属用户创建的图象

个人回收站

同系统回收站,区别于用户级和系统级的使用


我的个人信息


登陆系统的用户对个人信息进行修改,密码等

五、数据库设计

CREATE TABLE `scool_catalog` (
`catalog_id` varchar(10) NOT NULL,
`parent_id` varchar(10) NOT NULL default 'FFFFFFFFFF',
`name` varchar(20) NOT NULL,
`refuse_user` text,
`create_date` datetime default NULL,
`level` char(1) NOT NULL default '0',
PRIMARY KEY (`catalog_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


CREATE TABLE `scool_group` (
`group_id` varchar(10) NOT NULL,
`group_name` varchar(20) NOT NULL,
`popedom_value` bigint(64) default NULL,
PRIMARY KEY (`group_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


CREATE TABLE `scool_image` (
`image_id` varchar(10) NOT NULL,
`file_name` varchar(60) NOT NULL,
`is_delete` char(1) NOT NULL default '0',
`catalog_f_id` varchar(10) NOT NULL,
`catalog_s_id` varchar(10) NOT NULL,
`image_name` varchar(60) NOT NULL,
`size` int(32) NOT NULL default '0',
`description` text,
`create_date` datetime NOT NULL,
`WH` varchar(20) default NULL,
`user_name` varchar(20) default NULL,
`operator` varchar(20) default NULL,
`remove_date` datetime default NULL,
PRIMARY KEY (`image_id`),
KEY `title_index` (`file_name`),
KEY `user_name_index` (`user_name`),
KEY `operator_index` (`operator`),
KEY `image_name_index` (`image_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


CREATE TABLE `scool_user` (
`user_name` varchar(20) NOT NULL,
`password` varchar(32) NOT NULL,
`real_name` varchar(10) default NULL,
`sex` char(1) NOT NULL default '0',
`status` char(1) NOT NULL default '0',
`group_id` varchar(10) default NULL,
`role` char(1) NOT NULL default '0',
PRIMARY KEY (`user_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍
webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

六、系统预览

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

webwork+freemarker+hibernate开发样版图像管理系统的详细介绍

七、详细设计(节选)

1.数据访问核心类HibernateDao.java

/**
* HibernateDao
*/
package com.school71.imageims.dao;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Iterator;
//import java.lang.reflect.Field;

import com.school71.imageims.model.Garbage;
import com.school71.imageims.model.Image;
import com.school71.imageims.util.GeneratorUtil;
import com.school71.imageims.util.HibernateUtil;
import com.school71.imageims.util.FileUtil;
import com.school71.imageims.cfg.Config;

import org.hibernate.CacheMode;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.proxy.HibernateProxy;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


/**
* @author <a href="mailto:sogui@126.com">sogui</a>
* @version 1.0
* @date 2006 2006-9-18 22:38:20
*/
public class HibernateDao {
private static final Log log=LogFactory.getLog(HibernateDao.class);
public static final String SUPER_USER_NAME="root";
/**
*
* @param hql
* @return
* @TODO get a data object by specify hql
*/

@SuppressWarnings("finally")
protected Object getDataByHql(String hql){
Object object=null;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
Query query=session.createQuery(hql);
//.setCacheable(true)
//.setCacheMode(CacheMode.NORMAL);
object=query.uniqueResult();
ts.commit();
} catch (HibernateException e) {
log.error("Error to get a data object by hql=:"+hql,e);
ts.rollback();
}finally{
//closeSession();
return object;
}
}
/**
*
* @param clazz
* @param param
* @param value
* @param operator
* @return
* @TODO
*/
protected Object getData(Class clazz,String[]param,String[]value,String operator){
StringBuffer sb=new StringBuffer();
sb.append("from ");
sb.append(clazz.getSimpleName());
sb.append(" as tb");
sb.append(" where");
for(int i=0;i<param.length;i++){
sb.append(" tb.");
sb.append(param[i]);
sb.append(" =");
sb.append("'");
sb.append(value[i]);
sb.append("'");
if(i!=param.length-1){
sb.append(operator);
}
}
return getDataByHql(sb.toString());
}

protected Object getData(Class clazz,Map<String,String> paramMap,String operator){
StringBuffer sb=new StringBuffer();
sb.append("from ");
sb.append(clazz.getSimpleName());
sb.append(" as tb");
sb.append(" where");
for(Iterator it=paramMap.keySet().iterator();it.hasNext();){
String key=(String)it.next();
sb.append(" tb.");
sb.append(key);
sb.append("='");
sb.append(paramMap.get(key));
sb.append("'");
if(it.hasNext()){
sb.append(operator);
}
}
return getDataByHql(sb.toString());
}

/**
* if close the session then lazy function will not be executed
* @param clazz
* @param key
* @return
* @TODO
*/
@SuppressWarnings("finally")
protected Object getDataByKey(Class clazz,Serializable key){
Object object=null;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
object=session.get(clazz,key);
ts.commit();
} catch (HibernateException e) {
ts.rollback();
log.error("Error to get a "+clazz.getName()+" data object by key="+key,e);
}finally{
//closeSession();
return object;
}
}

@SuppressWarnings("finally")
protected List getDataListByHql(String hql,int pageNo,int pageSize){
List list=null;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
Query query=session.createQuery(hql)
//.setCacheable(true)
//.setCacheMode(CacheMode.NORMAL)
.setFirstResult((pageNo-1) * pageSize)
.setMaxResults(pageSize);

list=query.list();
ts.commit();
} catch (HibernateException e) {
log.error("Occur an error when get list by hql : "+hql,e);
}finally{
//closeSession();
return list;
}
}

@SuppressWarnings("finally")
protected List getDataListByHql(String hql){
List list=null;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
Query query=session.createQuery(hql);
//.setCacheable(true)
//.setCacheMode(CacheMode.NORMAL);
list=query.list();
ts.commit();
} catch (HibernateException e) {
ts.rollback();
log.error("Error to get a list by hql :"+hql,e);
e.printStackTrace();
}finally{
//closeSession();
return list;
}
}
/**
*
* @param hql
* @return
* @TODO
*/
@SuppressWarnings("finally")
protected Integer getDataCountByHql(String hql){
int count=0;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
count=(Integer)session.createQuery(hql).list().iterator().next();
ts.commit();
} catch (HibernateException e) {
ts.rollback();
log.error("Error to get record count");
}finally{
closeSession();
return count;
}

}

@SuppressWarnings("finally")
protected Integer getDataCountByHql(String tempHql,Map paramMap){
int count=0;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
Query query=session.createQuery(tempHql);
query=fillQuery(query,paramMap);
count=(Integer)query.uniqueResult();
ts.commit();
} catch (HibernateException e) {
log.error("Error to count the record count",e);
}finally{
closeSession();
return count;
}
}
/**
*
* @param sql
* @return
* @TODO get data object by specify sql
*/
protected Object getDataBySql(String sql){
return null;
}
/**
*
* @return
* @TODO
*/
protected Session openSession(){
return HibernateUtil.currentSession();
}
/**
*
*
* @TODO
*/
protected void closeSession(){
HibernateUtil.closeSession();
}
/**
*
* @param object
* @return
* @TODO
*/
@SuppressWarnings("finally")
protected boolean saveData(Object object){
boolean isSuccess=false;
Session session = openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
session.save(object);
session.flush();
ts.commit();
isSuccess=true;
} catch (HibernateException e) {
ts.rollback();
log.error("Error to save a data object to database",e);
}finally{
closeSession();
return isSuccess;
}
}

protected int deleteGarbage(List<Garbage> garbageList){
int resCount=0;
for(Iterator it=garbageList.iterator();it.hasNext();){
Garbage garbage=(Garbage)it.next();
if(deleteGarbage(garbage)){
resCount++;
}
}
return resCount;
}
@SuppressWarnings("finally")
protected boolean deleteGarbage(Garbage garbage){
boolean isSuccess=false;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
session.delete(garbage);
StringBuffer sb=new StringBuffer();
sb.append(Config.getFileRootPath());
sb.append("/");
sb.append(garbage.getParentCatalog().getCatalogId());
sb.append("/");
sb.append(garbage.getChildCatalog().getCatalogId());
sb.append("/");
Date date=garbage.getCreateDate();
Calendar calendar=Calendar.getInstance();
calendar.setTime(date);
sb.append(calendar.get(Calendar.YEAR));
sb.append("/");
sb.append(calendar.get(Calendar.MONTH)+1);
sb.append("/");
sb.append(calendar.get(Calendar.DAY_OF_MONTH));
String oldDirectoryName=sb.toString();

sb=new StringBuffer();
sb.append(Config.getGarbageRootPath());
sb.append("/");
sb.append(garbage.getParentCatalog().getCatalogId());
sb.append("/");
sb.append(garbage.getChildCatalog().getCatalogId());
String newDirectoryName=sb.toString();
FileUtil.moveFile(garbage.getImageName(),oldDirectoryName,newDirectoryName);
ts.commit();
isSuccess=true;
} catch (HibernateException e) {
ts.rollback();
log.error("Error to delete data object ",e);
}finally{
return isSuccess;
}
}

@SuppressWarnings("finally")
protected boolean saveImage(Image image,File file){
StringBuffer directory=null;
String destFileName=null;
boolean isSuccess=false;
Session session =openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
//String suffix=file.getName().substring(file.getName().lastIndexOf("."));
//String destFileName=GeneratorUtil.getChar10()+suffix;
destFileName=image.getFileName();
//image.setFileName(destFileName);
session.save(image);
directory=new StringBuffer();
directory.append(Config.getFileRootPath());
directory.append("/");
directory.append(image.getParentCatalog().getCatalogId());
directory.append("/");
directory.append(image.getChildCatalog().getCatalogId());
directory.append("/");
Calendar calendar=Calendar.getInstance();
directory.append(calendar.get(Calendar.YEAR));
directory.append("/");
int month=calendar.get(Calendar.MONTH)+1;
directory.append(month<10 ? "0"+month : month);
directory.append("/");
directory.append(calendar.get(Calendar.DAY_OF_MONTH));
FileUtil.saveFile(file,directory.toString(),destFileName);
ts.commit();
isSuccess=true;
} catch (HibernateException e) {
ts.rollback();
log.error("Error to save a image data object"+image.toString());
try {
FileUtil.deleteFile(directory.toString(),destFileName);
} catch (IOException e1) {
log.error("Error to delete the uploaded file when occured a HibernateException",e1);
}
}catch (IOException ex) {
log.error("Error to upload file :"+file.getAbsolutePath());
}finally{
return isSuccess;
}
}


@SuppressWarnings("finally")
protected boolean updateImage(Image image,String oldPCatalogId,String oldCCatalogId){
StringBuffer directory=null;
StringBuffer oldDirectory=null;
boolean isSuccess=false;
Session session =openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
session.update(image);
if(!oldPCatalogId.equals(image.getParentCatalog().getCatalogId())||!oldCCatalogId.equals(image.getChildCatalog().getCatalogId())){
directory=new StringBuffer();
oldDirectory=new StringBuffer();
directory.append(Config.getFileRootPath());
oldDirectory.append(Config.getFileRootPath());
directory.append("/");
oldDirectory.append("/");
directory.append(image.getParentCatalog().getCatalogId());
oldDirectory.append(oldPCatalogId);
directory.append("/");
oldDirectory.append("/");
directory.append(image.getChildCatalog().getCatalogId());
oldDirectory.append(oldCCatalogId);
directory.append("/");
oldDirectory.append("/");
Calendar calendar=Calendar.getInstance();
calendar.setTime(image.getCreateDate());
directory.append(calendar.get(Calendar.YEAR));
oldDirectory.append(calendar.get(Calendar.YEAR));
directory.append("/");
oldDirectory.append("/");
int month=calendar.get(Calendar.MONTH)+1;
directory.append(month<10 ? "0"+month : month);
oldDirectory.append(month<10 ? "0"+month : month);
directory.append("/");
oldDirectory.append("/");
directory.append(calendar.get(Calendar.DAY_OF_MONTH));
oldDirectory.append(calendar.get(Calendar.DAY_OF_MONTH));
FileUtil.moveFile(image.getFileName(),oldDirectory.toString(),directory.toString());
}
ts.commit();
isSuccess=true;
} catch (HibernateException e) {
ts.rollback();
log.error("Error to update a image data object"+image.toString());
try {
FileUtil.moveFile(image.getFileName(),directory.toString(),oldDirectory.toString());
} catch (IOException e1) {
log.error("Error to move the file from "+directory.toString()+" to "+oldDirectory.toString()+" when occured a HibernateException",e1);
}
}catch (IOException ex) {
log.error("Error to move the file from "+oldDirectory.toString()+" to "+directory.toString()+" when occured a IOException");
}finally{
return isSuccess;
}
}
/**
*
* @param object
* @return
* @TODO
*/
@SuppressWarnings("finally")
protected boolean updateData(Object object/*,Serializable key*/){
boolean isSuccess=false;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
// Class clazz=object.getClass();
// Object updateObject=session.get(clazz,key);
// if(updateObject!=null){
// Field[] fs=clazz.getDeclaredFields();
// System.out.println("============"+fs.length);
// for(int i=0;i<fs.length;i++){
// Field field=fs[i];
// System.out.println(field.get(object));
// field.set(updateObject, field.get(object));
// }
// }
//
// session.update(updateObject);

session.update(object);
ts.commit();
isSuccess=true;
} catch (HibernateException e) {
ts.rollback();
e.printStackTrace();
log.error("Error to update a data object",e);
}
// catch (IllegalArgumentException e) {
// e.printStackTrace();
// }catch (IllegalAccessException e) {
// e.printStackTrace();
// }
finally{
closeSession();
return isSuccess;
}
}

@SuppressWarnings("finally")
protected int updateData(String hql,String param,Object[] paramValue){
int count=0;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
count = session.createQuery(hql)
//.setCacheable(true)
// .setCacheMode(CacheMode.NORMAL)
.setParameterList(param,paramValue)
.executeUpdate();
ts.commit();
} catch (HibernateException e) {
log.error("Error to update data by hql "+ hql +"paramValue"+paramValue.toString());

}finally{
return count;
}
}

@SuppressWarnings("finally")
protected int updateData(String hql){
int count=0;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
count=session.createQuery(hql)
//.setCacheable(true)
//.setCacheMode(CacheMode.NORMAL)
.executeUpdate();
ts.commit();
} catch (HibernateException e) {
ts.rollback();
log.error("Error to update by hql :"+hql);
}finally{
return count;
}
}
/**
*
* @param clazz
* @param paramName
* @param paramValue
* @return
* @TODO
*/
protected boolean deleteData(Class clazz,String paramName,String paramValue){
int count=0;
StringBuffer sb=new StringBuffer();
sb.append("delete ");
sb.append(clazz.getSimpleName());
sb.append(" where ");
sb.append(paramName);
sb.append(" ='");
sb.append(paramValue);
sb.append("'");
count=deleteDataByHql(sb.toString());
return count > 0 ? true : false;
}

/**
*
* @param clazz
* @param keyValue
* @return
* @TODO
*/
@SuppressWarnings("finally")
protected boolean deleteData(Class clazz,Serializable keyValue){
boolean isSuccess=false;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
Object object=session.get(clazz,keyValue);
if(object!=null){
session.delete(object);
isSuccess=true;
}
ts.commit();
} catch (HibernateException e) {
ts.rollback();
e.printStackTrace();
}finally{
closeSession();
return isSuccess;
}
}
/**
*
* @param hql
* @param param
* @param paramValue
* @return
* @TODO
*/
@SuppressWarnings("finally")
protected int deleteData(String hql,String param,Object[] paramValue){
int count=0;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
count=session.createQuery(hql)
//.setCacheable(true)
//.setCacheMode(CacheMode.NORMAL)
.executeUpdate();
ts.commit();
} catch (HibernateException e) {
ts.rollback();
log.error("Error to delete data by hql :"+hql +" paramValue "+paramValue.toString());
}finally{
return count;
}
}

@SuppressWarnings("finally")
protected int deleteData(String hql){
int count=0;
Session session=openSession();
Transaction ts=session.getTransaction();
try {
ts.begin();
count=session.createQuery(hql)
//.setCacheable(true)
//.setCacheMode(CacheMode.NORMAL)
.executeUpdate();
ts.commit();
} catch (HibernateException e) {
ts.rollback();
log.error("Error to delete data by hql :"+hql);
}finally{
return count;
}
}
/**
*
* @param hql
* @return
* @TODO delete record batch not cascade delete
*/
@SuppressWarnings("finally")
protected int deleteDataByHql(String hql){
int count=0;
Session session=openSession();
Transaction ts=null;
try {
ts=session.beginTransaction();
count=session.createQuery(hql)
//.setCacheable(true)
//.setCacheMode(CacheMode.NORMAL)
.executeUpdate();
ts.commit();
} catch (HibernateException e) {
ts.rollback();
log.error("Error to delete data object by hql : " +hql,e);
}finally{
closeSession();
return count;
}
}
/**
*
* @param tableName
* @param theClass
* @param where
* @param arg
* @return
* @TODO
*/
protected List executeSQLQuery(String tableName, Class theClass, String where, Object arg[]) {
Session session = openSession();
SQLQuery q = session.createSQLQuery( "select {" + tableName + ".*} from " + tableName + " where " + where);
//System.out.println( "select {" + tableName + ".*} from " + tableName + " where " + where);
q.addEntity( tableName, theClass );
q=fillQuery(q,arg);
List list = q.list();
// closeSession();
return list;
}

private SQLQuery fillQuery(SQLQuery query,Object[] arg){
int l = arg.length;
for (int i = 0; i < l; i++) {
if (arg[i] instanceof Integer) {
query.setInteger( i, ((Integer)arg[i]).intValue() );
}
else if (arg[i] instanceof Short) {
query.setShort( i, ((Short)arg[i]).shortValue() );
}
else if (arg[i] instanceof Long) {
query.setLong( i, ((Long)arg[i]).longValue() );
}
else if (arg[i] instanceof Double) {
query.setDouble( i, ((Double) arg[i]).doubleValue() );
}
else if (arg[i] instanceof Float) {
query.setFloat( i, ((Float) arg[i]).floatValue() );
}
else if (arg[i] instanceof BigDecimal) {
query.setBigDecimal( i, (BigDecimal) arg[i] );
}
else if (arg[i] instanceof BigInteger) {
query.setBigInteger( i, (BigInteger) arg[i] );
}
else if (arg[i] instanceof String) {
query.setString( i, (String) arg[i] );
}
else if (arg[i] instanceof Boolean) {
query.setBoolean( i, ((Boolean) arg[i]).booleanValue() );
}
else if (arg[i] instanceof Date) {
query.setDate( i, (Date) arg[i] );
}
else if (arg[i] instanceof Date) {
query.setDate( i, (Date) arg[i] );
}
else {
throw new IllegalStateException( "bad type" );
}
}
return query;
}
/**
*
* @param query
* @param paramMap
* @return
* @TODO
*/
private Query fillQuery(Query query,Map paramMap){
for(Iterator it=paramMap.keySet().iterator();it.hasNext();){
String key=(String)it.next();
Object object=paramMap.get(key);
if (object instanceof Integer) {
query.setInteger( key, ((Integer)object).intValue() );
}
else if (object instanceof Short) {
query.setShort( key, ((Short)object).shortValue() );
}
else if (object instanceof Long) {
query.setLong( key, ((Long)object).longValue() );
}
else if (object instanceof Double) {
query.setDouble( key, ((Double) object).doubleValue() );
}
else if (object instanceof Float) {
query.setFloat( key, ((Float) object).floatValue() );
}
else if (object instanceof BigDecimal) {
query.setBigDecimal( key, (BigDecimal) object );
}
else if (object instanceof BigInteger) {
query.setBigInteger( key, (BigInteger) object );
}
else if (object instanceof String) {
query.setString( key, (String) object );
}
else if (object instanceof Boolean) {
query.setBoolean( key, ((Boolean) object).booleanValue() );
}
else if (object instanceof Date) {
query.setDate( key, (Date) object );
}
else if (object instanceof Date) {
query.setDate( key, (Date) object );
}
else {
throw new IllegalStateException( "bad type" );
}
}
return query;
}

protected StringBuffer checkHql(StringBuffer sb){
if(log.isDebugEnabled()){
log.debug("sb before delete="+sb.toString());
}
int start=sb.indexOf("where");


本文地址:http://www.45fan.com/a/question/72529.html
Tags: 开发 样版
编辑:路饭网
关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部