JAVA basic knowledge points (systematic)

                        Basic knowledge of JAVA (systematic)

 One, basic notes

  1. @GeneratedValue : Used to mark the generation strategy of the primary key, specified by the strategy attribute. By default, JPA automatically selects a primary key generation strategy that is most suitable for low-level databases: IDENTITY, AUTO, SEQUENCE, TABLE
  2. @Entity entity class ,    @Column (name="LAST_NAME"), used when the attribute of the entity and the column of the mapped database table are different
  3. @Basic represents a simple attribute to database field mapping. For the getXxxx() method without any annotation, the default is @Basic, and fetch represents the read strategy of the attribute, there are two types: EAGER and LAZY. Represents the main branch grabbing and lazy loading respectively, and the default is EAGER. optional: Indicates whether the attribute allows null, the default is true.
  4.  @Transient indicates that this attribute is not a mapping to a field of the data table, and the ORM framework will ignore this attribute.
  5.  EntityManagerFactory: The interface is mainly used for creation, and the following 4 methods are agreed upon:

    1), CreateEntityManger(): Used to create entity manager object instances.

     2), CreateEntityManger(): An overloaded method used to create an object instance of the entity manager, and the Map parameter is used to provide the properties of the EntityManager.

     3), IsOpen(): Check whether the EntityManagerFactory is open. The entity manager factory is always open after it is created, unless the close() method is called to close it.

     4), Close(): Close EntityManagerFactory. All resources will be released after closing, isOpen method test

     5), Merage(T entity): Merage() is used to handle the synchronization of Entity, that is, the database insert and update operations.

 

Two, JPQL language

  • Support for adding, deleting, modifying and checking sentences
  • Support several functions

 

Three, Spirng integrates JPA (3 types)

1. Select LocalContainerEntityManagerFactoryBean: FactoryBean suitable for all environments, which can fully control the EntityManagerFactory configuration, such as specifying the DataSource defined by Spring and so on.

 

Four, SpringData

  1.       A subproject of spring. Used to simplify database access, support NoSql and relational data storage. The main goal is to make database access convenient and fast. Support NoSql storage. Support relational data storage technology: JDBC, JPA.
  2.     JPA SpringData: Committed to reducing the amount of data access layer (DAO) development. The only thing developers have to do is to declare the interface of the persistence layer, and Spring Data JPA will do the rest for you.

 五,SpringMVC+Spring+SpringData\JPA

Guess you like

Origin blog.csdn.net/qq_36774734/article/details/112462140