hibernate中的session同jsp中的sesssion有什么关系?有什么不同?

vcshcn 2004-11-02 12:53:13
hibernate中从sessionfactory中取得的session同jsp中的sesssion有什么关系?有什么不同?
...全文
181 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhaoyongqiang 2004-11-02
  • 打赏
  • 举报
回复
它们之间没有什么关系。它们的名字相同主要是它们的用用途是一样的,都是为了维持一个会话。不知道对不对?
jspxnet 2004-11-02
  • 打赏
  • 举报
回复
他们之间没关系,唯一的相同就是都有个 session
kui 2004-11-02
  • 打赏
  • 举报
回复
不同,hibernate中的session是org.hibernate.Session;的对象:

//$Id: Session.java,v 1.8 2004/08/09 14:35:17 steveebersole Exp $
package org.hibernate;

import java.io.Serializable;
import java.sql.Connection;
public interface Session extends Serializable {
public void flush() throws HibernateException;
public void setFlushMode(FlushMode flushMode);

/**
* Get the current flush mode.
*
* @return FlushMode
*/
public FlushMode getFlushMode();

/**
* Get the <tt>SessionFactory</tt> that created this instance.
* @see SessionFactory
*/
public SessionFactory getSessionFactory();

/**
* Get the JDBC connection. Applications are responsible for
* calling commit/rollback upon the connection before closing
* the <tt>Session</tt>.
*
* @return the JDBC connection in use by the <tt>Session</tt>
* @throws HibernateException if the <tt>Session</tt> is disconnected
*/
public Connection connection() throws HibernateException;
public Connection disconnect() throws HibernateException;

/**
* Obtain a new JDBC connection. This is used by applications which
* require long transactions.
*
* @see Session#disconnect()
* @throws HibernateException
*/
public void reconnect() throws HibernateException;
public void reconnect(Connection connection) throws HibernateException;


public Connection close() throws HibernateException;
public void cancelQuery() throws HibernateException;

/**
* Check if the <tt>Session</tt> is still open.
*
* @return boolean
*/
public boolean isOpen();

/**
* Check if the <tt>Session</tt> is currently connected.
*
* @return boolean
*/
public boolean isConnected();

/**
* Does this <tt>Session</tt> contain any changes which must be
* synchronized with the database? Would any SQL be executed if
* we flushed this session?
*
* @return boolean
*/
public boolean isDirty() throws HibernateException;
public Serializable getIdentifier(Object object) throws HibernateException;

public boolean contains(Object object);

public void evict(Object object) throws HibernateException;

/**
* Return the persistent instance of the given entity class with the given identifier,
* obtaining the specified lock mode, assuming the instance exists.
*
* @param theClass a persistent class
* @param id a valid identifier of an existing persistent instance of the class
* @param lockMode the lock level
* @return the persistent instance or proxy
* @throws HibernateException
*/
public Object load(Class theClass, Serializable id, LockMode lockMode) throws HibernateException;

/**
* Return the persistent instance of the given entity class with the given identifier,
* obtaining the specified lock mode, assuming the instance exists.
*
* @param entityName a persistent class
* @param id a valid identifier of an existing persistent instance of the class
* @param lockMode the lock level
* @return the persistent instance or proxy
* @throws HibernateException
*/
public Object load(String entityName, Serializable id, LockMode lockMode) throws HibernateException;


public Object load(Class theClass, Serializable id) throws HibernateException;


public Object load(String entityName, Serializable id) throws HibernateException;


public void load(Object object, Serializable id) throws HibernateException;


public void replicate(Object object, ReplicationMode replicationMode) throws HibernateException;
public void replicate(String entityName, Object object, ReplicationMode replicationMode) throws HibernateException;


public Serializable save(Object object) throws HibernateException;

..............



public void disableFilter(String filterName);

}
mbl 2004-11-02
  • 打赏
  • 举报
回复
不知道
shangqiao 2004-11-02
  • 打赏
  • 举报
回复
晕!那他们两个和jmail里面的Session是什么关系,和jms里面的Session有什么关系
show90 2004-11-02
  • 打赏
  • 举报
回复
它们之间没有什么关系

67,549

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧