package org.scbit.blob.model;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* A data access object (DAO) providing persistence and search support for Test
* entities. Transaction control of the save(), update() and delete() operations
* can directly support Spring container-managed transactions or they can be
* augmented to handle user-managed Spring transactions. Each of these methods
* provides additional information for how to configure it for the desired type
* of transaction control.
*
* @see org.scbit.blob.model.Test
* @author MyEclipse Persistence Tools
*/
public class TestDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(TestDAO.class);
// property constants
public static final String NAME = "name";
public static final String IMAGE = "image";
protected void initDao() {
// do nothing
}
public void save(Test transientInstance) {
log.debug("saving Test instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(Test persistentInstance) {
log.debug("deleting Test instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Test findById(java.lang.Long id) {
log.debug("getting Test instance with id: " + id);
try {
Test instance = (Test) getHibernateTemplate().get(
"org.scbit.blob.model.Test", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(Test instance) {
log.debug("finding Test instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding Test instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Test as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByName(Object name) {
return findByProperty(NAME, name);
}
public List findByImage(Object image) {
return findByProperty(IMAGE, image);
}
public List findAll() {
log.debug("finding all Test instances");
try {
String queryString = "from Test";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public Test merge(Test detachedInstance) {
log.debug("merging Test instance");
try {
Test result = (Test) getHibernateTemplate().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(Test instance) {
log.debug("attaching dirty Test instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(Test instance) {
log.debug("attaching clean Test instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static TestDAO getFromApplicationContext(ApplicationContext ctx) {
return (TestDAO) ctx.getBean("TestDAO");
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Struts2,Hibernate3,Spring2实现oracle存取blob字段(图片等二进制文件)<br>Myeclipse6.0下开发 哈哈,原来2分的,现在免费了!!!!!!!!!!!!!!!!!!!!!!!!给评分哦!!!!!!!!!!!!!!!!
资源推荐
资源详情
资源评论
收起资源包目录
blobTest.rar (43个子文件)
blobTest
database.sql 718B
.springBeans 320B
.myhibernatedata 514B
.settings
org.eclipse.core.resources.prefs 88B
src
struts.xml 646B
org
scbit
blob
dao
action
BlobTest.java 2KB
model
Test.java 925B
TestDAO.java 4KB
Test.hbm.xml 776B
applicationContext.xml 2KB
.project 2KB
WebRoot
META-INF
MANIFEST.MF 39B
WEB-INF
web.xml 1KB
classes
struts.xml 646B
org
scbit
blob
dao
action
BlobTest.class 3KB
model
Test.class 1KB
TestDAO.class 5KB
Test.hbm.xml 776B
applicationContext.xml 2KB
lib
struts2-core-2.0.6.jar 2.09MB
tiles-jsp-2.0.4.jar 46KB
spring.jar 2.58MB
log4j-1.2.9.jar 344KB
struts2-tiles-plugin-2.0.11.jar 16KB
struts2-spring-plugin-2.0.11.jar 9KB
ojdbc14.jar 1.47MB
commons-digester-1.8.jar 140KB
commons-beanutils-1.6.jar 116KB
commons-io-1.1.jar 60KB
commons-collections-2.1.1.jar 171KB
ognl-2.6.11.jar 164KB
commons-fileupload-1.1.1.jar 31KB
commons-logging-1.1.jar 52KB
commons-pool.jar 61KB
commons-dbcp.jar 119KB
freemarker-2.3.8.jar 784KB
tiles-core-2.0.4.jar 123KB
xwork-2.0.1.jar 442KB
tiles-api-2.0.4.jar 16KB
index.jsp 834B
.mymetadata 297B
.classpath 2KB
.myeclipse
阿糖胞苷.png 4KB
共 43 条
- 1
shen_haisheng
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页