我想查询hibernate里面session的具体用法,我知道可以用javaAPI来查,可是我的javaAPI怎么没有啊?
2个回答
展开全部
hibernate 里面的session 是在hibernate 的jar包里面的,不是java 库里面的,
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.dao.support.DaoSupport;
import org.springframework.stereotype.Component;
import com.jason.dao.CommonDao;
import com.mchange.v2.c3p0.ComboPooledDataSource;
/**
* Class Name:CommonDaoImpl.java
* Class Description:
* @param <T>
* @Author: Jason
* @Create: 11:20:48 PM
* @Version: v1.0
*/
@Component("CommonDao")
public class CommonDaoImpl implements CommonDao {
@Autowired
@Qualifier("sessionFactory")
private SessionFactory sessionFactory;
@Autowired
@Qualifier("dataSource")
private ComboPooledDataSource dataSource;
public Session getSession()
{
return this.sessionFactory.getCurrentSession();
}
public Connection getConnection() throws SQLException{
return dataSource.getConnection();
在hibernate-core包里面,我这里只有4.1版的jar包
http://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/Session.html 这是api 文档
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询