-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelper.txt
72 lines (60 loc) · 2.05 KB
/
helper.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
node:
fields:
field:
name: "title"
sql:
column: "title"
type: "varchar"
html:
widget: "input"
type: "text"
title: "title"
value: ""
field:
name: ""
sql:
column:
type:
html:
widget:
value:
restart java application
http://lewisleo.blogspot.jp/2012/08/programmatically-restart-java.html
hibernate 5 documentation // see createFilter()
https://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#mapping-column-filter
Ehcache documentation
http://www.ehcache.org/documentation/2.7/integrations/hibernate.html
Hibernate query cache
http://puredanger.github.io/tech.puredanger.com/2009/07/10/hibernate-query-cache/
Hibernate EHCache – Hibernate Second Level Cache
http://www.journaldev.com/2980/hibernate-ehcache-hibernate-second-level-cache
------------------------------ Scroller pager------------------------
Query query = session.createQuery(query);
query.setReadOnly(true);
setFetchSize(Integer.MIN_VALUE); //MUST use Integer.MIN_VALUE, other value=fetch all
ScrollableResults results = query.scroll(ScrollMode.FORWARD_ONLY);
// iterate over results
while (results.next()) {
Object row = results.get();
}
results.close();
----------------------- Lazy initialize-----------------------------
http://stackoverflow.com/questions/15359306/how-to-load-lazy-fetched-items-from-hibernate-jpa-in-my-controller
@Override
public FaqQuestions getFaqQuestionById(Long questionId) {
session = sessionFactory.openSession();
tx = session.beginTransaction();
FaqQuestions faqQuestions = null;
try {
faqQuestions = (FaqQuestions) session.get(FaqQuestions.class,
questionId);
Hibernate.initialize(faqQuestions.getFaqAnswers());
tx.commit();
faqQuestions.getFaqAnswers().size();
} finally {
session.close();
}
return faqQuestions;
}
------------------------h2 backup ------------------
java -cp h2-1.4.192.jar org.h2.tools.Script -url jdbc:h2:b:/tmp/rvc/h2cms -user sa -password 12345 -script test.zip -options compression zip