You are on page 1of 3

1/24/2016

HibernateSessions

S.N.

SessionMethodsandDescription

TransactionbeginTransaction()

Begin a unit of work and return the associated


Transactionobject.
2

voidcancelQuery()

Canceltheexecutionofthecurrentquery.
3

voidclear()

Completelyclearthesession.
4

Connectionclose()

EndthesessionbyreleasingtheJDBCconnectionand
cleaningup.
5

CriteriacreateCriteria(ClasspersistentClass)

Create a new Criteria instance, for the given entity


class,orasuperclassofanentityclass.
6

CriteriacreateCriteria(StringentityName)

Create a new Criteria instance, for the given entity


name.
7

SerializablegetIdentifier(Objectobject)

Return the identifier value of the given entity as


associatedwiththissession.
8

QuerycreateFilter(Objectcollection,String
queryString)

Create a new instance of Query for the given


collectionandfilterstring.
9

QuerycreateQuery(StringqueryString)

Create a new instance of Query for the given HQL


querystring.
10

SQLQuerycreateSQLQuery(StringqueryString)

CreateanewinstanceofSQLQueryforthegivenSQL
http://www.tutorialspoint.com/hibernate/hibernate_sessions.htm

1/3

1/24/2016

HibernateSessions

querystring.
11

voiddelete(Objectobject)

Removeapersistentinstancefromthedatastore.
12

voiddelete(StringentityName,Objectobject)

Removeapersistentinstancefromthedatastore.
13

Sessionget(StringentityName,Serializableid)

Return the persistent instance of the given named


entity with the given identifier, or null if there is no
suchpersistentinstance.
14

SessionFactorygetSessionFactory()

Getthesessionfactorywhichcreatedthissession.
15

voidrefresh(Objectobject)

Reread the state of the given instance from the


underlyingdatabase.
16

TransactiongetTransaction()

Get the Transaction instance associated with this


session.
17

booleanisConnected()

Checkifthesessioniscurrentlyconnected.
18

booleanisDirty()

Doesthissessioncontainanychangeswhichmustbe
synchronizedwiththedatabase?
19

booleanisOpen()

Checkifthesessionisstillopen.
20

Serializablesave(Objectobject)

Persist the given transient instance, first assigning a


generatedidentifier.
21

voidsaveOrUpdate(Objectobject)

http://www.tutorialspoint.com/hibernate/hibernate_sessions.htm

2/3

1/24/2016

HibernateSessions

Either save(Object) or update(Object) the given


instance.
22

voidupdate(Objectobject)

Update the persistent instance with the identifier of


thegivendetachedinstance.
23

voidupdate(StringentityName,Objectobject)

Update the persistent instance with the identifier of


thegivendetachedinstance.

http://www.tutorialspoint.com/hibernate/hibernate_sessions.htm

3/3

You might also like