首页>代码>采用struts2+hibernate实现保存文件到Oracle数据库&&并附下载代码【导入即可用】;数据库中保存blob类型的二进制文件>/blob_hibernate/src/org/dao/BaseDao.java
package org.dao; import java.io.Serializable; import java.util.List; import org.common.HibernateSessionFactory; import org.entity.Testblob; import org.hibernate.Session; import org.hibernate.Transaction; public class BaseDao implements IDao { protected Session session; protected Transaction tx; protected void open(){ session = HibernateSessionFactory.getSession(); } protected void close(){ session.close(); } protected void begin(){ tx = session.beginTransaction(); } protected void commit(){ tx.commit(); } @Override public void add(Testblob entity) { // TODO Auto-generated method stub } @Override public List<Testblob> findAll() { // TODO Auto-generated method stub return null; } @Override public Testblob findBlobByRid(Serializable id) { // TODO Auto-generated method stub return null; } }