LB04 Entities and the Java Persistence API

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Great video :) Thanks for the explanation!!

alexandroskourtis
Автор

Thank you very much! Your video was very helpful.

SuriShaolin
Автор

0:35 annotations
1:56 dependency injection
3:07 JNDI
3:39 *resources that can be injected*
3:42 SessionContext, DataSource
3:45 EntityManager
4:13

4:26 JPA
5:16 Entity - 5:21 a POJO
5:56 it provides for *standardized object-relational mapping*
7:14 named queries

8:32 Key features of JPA
8:39 Detached entities
9:23 EntityManager - 9:30 perform CRUD operations on entities
9:38 persistence units
10:05 properties
10:37 identify persistence storage of the managed entities
10:54 identify the *transaction type*
11:07

ruixue
Автор

21:05 managing entities - EntityManager
21:56 Container-managed EntityManager
22:32 how to inject EntityManager into a component
22:55 meaning: when your class got this annotation, the *container* will detect the annotation and will then look for an existing EntityManager that can be used
23:19 JTA allows us to make use of transactions to make sure the the database and data models are properly synchronized
24:27 we should *always use the container-managed EntityManager* along with the JTA transactions
24:34 life-cycle of entity object
24:57 *new* - *no persistent identity* yet
25:36 *managed* - 25:47 this object is associated with a row in the (db) table, 25:52 in another word, this row will be inserted (into db)
26:34
27:15 *detached*
28:06 EntityManager.persist
28:52

ruixue
Автор

11:21 entities
11:51 *persistent state* of an entity is represented by persistent fields
11:58 persistent fields vs transient fields
12:37 requirement for entity class
12:44 must have a *public/protected no-argument constructor*
12:50 more constructors are allowed, but the no-argument constructor is compulsory
13:11 persistent fields must not be public
13:26 *detached entity object* - means we can pass them around => 13:34 must implement *Serializable*
13:47 example
17:11 composite primary key
17:22 1. write composite primary key wrapper class
17:55 2. @IdClass
18:26 still need @Id

ruixue
welcome to shbcf.ru