Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3e237f6

Browse files
+ navigation
1 parent ec4179e commit 3e237f6

File tree

1 file changed

+34
-25
lines changed

1 file changed

+34
-25
lines changed

‎README.md‎

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## Instructions
2+
- For best viewing experience on your phone switch to Desktop Mode
3+
- To view the entire page on phone click on **View all of README.md**
4+
- Best viewed on PC
5+
6+
## Navigation
7+
- [Hibernate FAQs](#hibernate-faqs)
8+
- [Spring FAQs](#spring-faqs)
9+
10+
11+
* * *
12+
113
## Hibernate FAQs
214

315
1. __`hibernate.cfg.xml` file__<br>
@@ -13,33 +25,30 @@
1325
- create-drop
1426
- validate
1527

16-
2. __Persistent Object & Collection Object__<br>
28+
2. __Persistent Object__<br>
1729
Persistent Object : <br>
1830
> Persistent objects are instances of POJO classes that you create that represent rows in the table in the database.
1931
> According to hibernate-doc an instance of POJO class representing table in database goes through 3 states of which persistent is one of them.
2032
21-
Collection Object : <br>
22-
2333
3. __Bag Collection__<br>
2434
A Bag is a java collection that stores elements without caring about the sequencing, but allow duplicate elements in the list. A bag is a random grouping of the objects in the list. A Collection is mapped with a `<bag>` element in the mapping table and initialized with `java.util.ArrayList`.
2535

26-
4. __Collection Mapping in Hibernate using XML__<br>
27-
5. __In which state object is not associated with Session__<br>
36+
4. __In which state object is not associated with Session__<br>
2837
Transient & Detached
2938

30-
6. __Different `@Annotations` in Hibernate__<br>
39+
5. __Different `@Annotations` in Hibernate__<br>
3140
- `@Entity`
3241
- `@Column`
3342
- `@Id`
3443
- `@GeneratedValue`
3544

36-
7. __Different types of Association Mapping in Hibernate__<br>
45+
6. __Different types of Association Mapping in Hibernate__<br>
3746
- OneToOne
3847
- OneToMany
3948
- ManyToOne
4049
- ManyToMany
4150

42-
8. __`get()` v/s `load()`__<br>
51+
7. __`get()` v/s `load()`__<br>
4352
<table>
4453
<tr>
4554
<th><samp>get()</samp></th>
@@ -63,15 +72,15 @@
6372
</tr>
6473
</table>
6574

66-
9. __Different Hibernate Inheritence Strategies__<br>
75+
8. __Different Hibernate Inheritence Strategies__<br>
6776
- Table Per Hierarchy
6877
- `@Inheritance(strategy=InheritanceType.SINGLE_TABLE) `
6978
- Table Per Concrete class
7079
- `@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)`
7180
- Table Per Subclass
7281
- `@Inheritance(strategy=InheritanceType.JOINED)`
7382

74-
10. __First Level Cache & Second Level Cache__<br>
83+
9. __First Level Cache & Second Level Cache__<br>
7584
First Level Cache:
7685
> First level is maintained at the Session level and accessible only to the Session.
7786
> Can use the first level cache to store local data i.e. the data which is needed by the Session
@@ -80,43 +89,43 @@
8089
> Second level cache is maintained at the SessionFactory level and available to all Sessions.
8190
> Can use the second level cache to store global data i.e. something which can be shared across sessions.
8291
83-
11. __Hibernate Architecture Layers__<br>
92+
10. __Hibernate Architecture Layers__<br>
8493
3 Main Layers
8594
- Java Application Layer
8695
- Hibernate Framework Layer
8796
- Backend API Layer _(Optional)_
8897
- DB Layer
8998

90-
12. __What is Hibernate?__<br>
99+
11. __What is Hibernate?__<br>
91100
Hibernate is a Java framework that simplifies the development of Java application to interact with the database. It is an open source, lightweight, ORM (Object Relational Mapping) tool. Hibernate implements the specifications of JPA (Java Persistence API) for data persistence.
92101

93-
13. __Configuration in Hibernate__<br>
102+
12. __Configuration in Hibernate__<br>
94103
- Combination of Configuration XML and Mapping XML file
95104
- Annotations
96105

97-
14. __Advantages and Jobs of ORM__<br>
106+
13. __Advantages and Jobs of ORM__<br>
98107
ORM stands for Object/Relational mapping. It is the programmed and translucent perseverance of objects in a Java application in to the tables of a relational database using the metadata that describes the mapping between the objects and the database. It works by transforming the data from one representation to another.
99108

100109
_Advantages:_
101110
- Speeds-up Development - eliminates the need for repetitive SQL code.
102111
- Overcomes vendor specific SQL differences - the ORM knows how to write vendor specific SQL so you don't have to.
103112

104-
15. __Criteria Query & How to create it__<br>
113+
14. __Criteria Query & How to create it__<br>
105114
Hibernate provides alternate ways of manipulating objects and in turn data available in RDBMS tables. One of the methods is Criteria API, which allows you to build up a criteria query object programmatically where you can apply filtration rules and logical conditions.
106115

107116
The Hibernate `Session` interface provides `createCriteria()` method, which can be used to create a `Criteria` object that returns instances of the persistence object's class when your application executes a criteria query.
108117

109-
16. __Significance of `hbm2ddl.auto`__<br>
118+
15. __Significance of `hbm2ddl.auto`__<br>
110119
`hibernate.hbm2ddl.auto` Automatically validates or exports schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly.
111120
- *validate*: validate the schema, makes no changes to the database.
112121
- *update*: update the schema.
113122
- *create*: creates the schema, destroying previous data.
114123
- *create-drop*: drop the schema when the SessionFactory is closed explicitly, typically when the application is stopped.
115124

116-
17. __Significance of Session object in Hibernate__<br>
125+
16. __Significance of Session object in Hibernate__<br>
117126
A Session is used to get a physical connection with a database. The Session object is lightweight and designed to be instantiated each time an interaction is needed with the database. Persistent objects are saved and retrieved through a Session object.
118127

119-
18. __Methods of Session object__<br>
128+
17. __Methods of Session object__<br>
120129
- `beginTransaction()`
121130
- `save()`
122131
- `update()`
@@ -128,7 +137,7 @@
128137
- `flush()`
129138
- `delete()`
130139

131-
19. __EAGER v/s LAZY loading__<br>
140+
18. __EAGER v/s LAZY loading__<br>
132141
Lazy loading:
133142
> Lazy Loading. It is the default behavior of an Entity Framework, where a child entity is loaded only when it is accessed for the first time.
134143
> It simply delays the loading of the related data, until you ask for it.
@@ -137,7 +146,7 @@
137146
> Eager Loading helps you to load all your needed entities at once; i.e., all your child entities will be loaded at single database call.
138147
> This can be achieved, using the Include method, which returs the related entities as a part of the query and a large amount of data is loaded at once.
139148
140-
20. __Significance of HQL__<br>
149+
19. __Significance of HQL__<br>
141150
It is more beneficial to use HQL instead of native SQ retrieve data from databases. The following are some of the reasons why HQL is preferred over SQL:
142151
- Provides full support for relational operations.
143152
- Return results as objects.
@@ -146,15 +155,15 @@
146155
- Supports many advanced features as compared to SQL, such as pagination, fetch join etc.
147156
- Provides database independency.
148157

149-
21. __Important components in Hibernate Architecture__<br>
158+
20. __Important components in Hibernate Architecture__<br>
150159
- Configuration Object
151160
- SessionFactory Object
152161
- Session Object
153162
- Transaction Object
154163
- Query Object
155164
- Criteria Object
156165

157-
22. __LifeCycle states of an object in Hibernate__<br>
166+
21. __LifeCycle states of an object in Hibernate__<br>
158167
- Transient State
159168
> A transient state is one where hibernate session is not associated with the object instance and does not represent a row in the database table.
160169
- Persistent State
@@ -164,11 +173,11 @@
164173
- Removed State
165174
> When the persistent object is deleted from the database, it is passed to the session’s `delete(obj)` method. At this state, java instance exists but any changes made to the object are not saved to the database.
166175
167-
23. __Different annotations used in `@ManyToMany` Association__<br>
176+
22. __Different annotations used in `@ManyToMany` Association__<br>
168177
- `@JoinTable`
169178
- `@JoinColumn`
170179

171-
24. __Properties in `HBM XML` file__<br>
180+
23. __Properties in `HBM XML` file__<br>
172181
- The mapping document is an XML document having `<hibernate-mapping>` as the root element, which contains all the `<class>` elements.
173182

174183
- The `<class>` elements are used to define specific mappings from a Java classes to the database tables. The Java class name is specified using the name attribute of the class element and the database table name is specified using the table attribute.
@@ -181,7 +190,7 @@
181190

182191
- The `<property>` element is used to map a Java class property to a column in the database table. The name attribute of the element refers to the property in the class and the column attribute refers to the column in the database table. The type attribute holds the hibernate mapping type, this mapping types will convert from Java to SQL data type.
183192

184-
25. __Named Query & Criteria Query__<br>
193+
24. __Named Query & Criteria Query__<br>
185194
- Named Query:
186195
> A named query is a statically defined query with a predefined unchangeable query string. They're validated when the session factory is created, thus making the application to fail fast in case of an error.
187196
- Criteria Query:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /