Best code examples for Hibernate ORM Session class (org.hibernate.Session)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM Session class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Hibernate ORM Session examples from Open Source projects
This code example shows how to use the following methods: flush
45:	this.session.flush(); 
Full Snippet Info
10
CodeRank
This code example shows how to use the following methods: close
121:	session.close(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: persist
47:	session.persist(member); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: delete
83:	session.delete(entity); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: flush
392:	session.flush(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: beginTransaction
66:	tx = session.beginTransaction(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: clear, contains, flush, saveOrUpdate
124:	when(factory.getCurrentSession()).thenReturn(currentSession); 
125:	when(currentSession.contains("foo")).thenReturn(true); 
126:	when(currentSession.contains("bar")).thenReturn(false); 
127:	currentSession.saveOrUpdate("bar"); 
128:	currentSession.flush(); 
129:	currentSession.clear(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: close
820:	session.close(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: beginTransaction
77:	tx = session.beginTransaction(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: clear, flush
140:	session.flush(); 
141:	session.clear(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isOpen
83:	if (session != null && !session.isOpen()) { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: close, persist, beginTransaction, getTransaction
36:	session.beginTransaction(); 
-
40:	session.persist( lib1 ); 
-
44:	session.persist( lib2 ); 
-
46:	session.getTransaction().commit(); 
47:	session.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: close, delete, get, beginTransaction
187:	tx = s.beginTransaction(); 
188:	w = (Worker) s.get( Worker.class, w.getId() ); 
189:	s.delete( w ); 
190:	c = (Construction) s.get( Construction.class, c.getId() ); 
191:	s.delete( c ); 
-
193:	s.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: close, createQuery
53:	when(sessionFactory.openSession()).thenReturn(session); 
54:	when(session.createQuery("testQuery")).thenReturn(scrollableResults); 
-
56:	when(session.close()).thenReturn(null); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: beginTransaction
81:	tx = session.beginTransaction(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: close, persist, beginTransaction
59:	Transaction tx = s.beginTransaction(); 
-
62:	s.persist( detective ); 
-
65:	s.persist( suspect ); 
-
67:	s.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: flush
92:	currentSession.flush(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: close, flush, save, beginTransaction
89:	Transaction t = session.beginTransaction(); 
-
92:	session.save( entity ); 
-
96:	session.save( reference ); 
-
99:	session.flush(); 
-
103:	session.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setFlushMode
44:	session.setFlushMode(FlushMode.MANUAL); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: beginTransaction
82:	tx = session.beginTransaction(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: close, save, beginTransaction
43:	Transaction transaction = session.beginTransaction(); 
-
56:	session.save( level1 ); 
57:	session.save( level2 ); 
58:	session.save( level3 ); 
-
63:	session.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: flush, save
140:	s.save( john ); 
141:	s.save( cust ); 
142:	s.save( ups ); 
-
144:	s.flush(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: clear, close, delete, get, persist
49:	Transaction tx = s.beginTransaction(); 
50:	s.persist( withoutPuppies ); 
51:	s.persist( wihKittens ); 
52:	s.persist( dog ); 
53:	s.persist( cat ); 
54:	s.persist( kittenOne ); 
55:	s.persist( KittenTwo ); 
-
66:	s.clear(); 
-
68:	tx = s.beginTransaction(); 
69:	s.delete( s.get( Man.class, withoutPuppies.getId() ) ); 
70:	s.delete( s.get( Man.class, wihKittens.getId() ) ); 
71:	s.delete( s.get( Pet.class, dog.getId() ) ); 
72:	s.delete( s.get( Pet.class, cat.getId() ) ); 
73:	s.delete( s.get( Puppy.class, kittenOne.getId() ) ); 
74:	s.delete( s.get( Puppy.class, KittenTwo.getId() ) ); 
-
77:	s.close(); 
-
168:	FullTextSession session = Search.getFullTextSession( s ); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: clear, close
56:	s.clear(); 
57:	deleteAll( s, ContainerEntity.class ); 
58:	s.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: close
105:	_session.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: close, isOpen
44:	if (session.isOpen()) { 
45:	session.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: close, save, beginTransaction
65:	Transaction transaction = session.beginTransaction(); 
-
68:	session.save( bridgedEntity ); 
-
72:	session.save( leaf ); 
-
77:	session.save( root ); 
-
82:	session.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: get
43:	Object currentObject = session.get( 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: close, flush, save, beginTransaction, createQuery
62:	Transaction tx = session.beginTransaction(); 
63:	session.save(cmslog); 
64:	session.flush();// 清空缓存后customer对象处于游离状态 
-
68:	int recordCount = session.createQuery( 
-
72:	session.close(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: beginTransaction
80:	Transaction transaction = session.beginTransaction(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: clear, close, flush, get, persist
42:	Transaction tx = s.beginTransaction(); 
-
44:	s.persist( u ); 
-
46:	s.persist( r ); 
-
48:	s.flush(); 
49:	s.clear(); 
50:	u = (User) s.get( User.class, u.getId() ); 
-
55:	s.close(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: close, persist, getTransaction
153:	s.getTransaction().begin(); 
-
158:	s.persist( ts ); 
159:	s.getTransaction().commit(); 
160:	FullTextSession fullTextSession = Search.getFullTextSession( s ); 
-
164:	s.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: clear, close, flush, get, persist
44:	Transaction tx = s.beginTransaction(); 
-
46:	s.persist( u ); 
-
48:	s.persist( r ); 
-
50:	s.flush(); 
51:	s.clear(); 
52:	u = (User) s.get( User.class, u.getId() ); 
-
57:	s.close(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: close, isOpen
113:	if (s != null && s.isOpen()) 
114:	s.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: close, load, beginTransaction, createQuery
160:	t = session.beginTransaction(); 
-
162:	order = (Orders) session.load(Orders.class, new Long(1) ); 
-
166:	order = (Orders) session.createQuery("from " + PACKAGE_NAME + ".Orders").uniqueResult(); 
-
170:	session.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: close, doWork, get, getTransaction
183:	s.getTransaction().begin(); 
184:	s.doWork( new Work() { 
-
194:	TShirt ts = (TShirt) s.get( TShirt.class, 1 ); 
195:	s.getTransaction().commit(); 
196:	s.close(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: save
39:	session.save(foo); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: close
134:	session.close(); 
Full Snippet Info
7
CodeRank
See Code Examples for Hibernate ORM Session Methods: