What is Persistence Context?

前端 未结 9 1804
难免孤独
难免孤独 2020-12-07 08:19

I am new to the Java world and JPA. I was studying JPA and came across many new terms like Entity, persistence. While reading, I could not understand the exact definition fo

9条回答
  •  Happy的楠姐
    2020-12-07 09:00

    Taken from this page:

    Here's a quick cheat sheet of the JPA world:

    • A Cache is a copy of data, copy meaning pulled from but living outside the database.
    • Flushing a Cache is the act of putting modified data back into the database.
    • A PersistenceContext is essentially a Cache. It also tends to have it's own non-shared database connection.
    • An EntityManager represents a PersistenceContext (and therefore a Cache)
    • An EntityManagerFactory creates an EntityManager (and therefore a PersistenceContext/Cache)

提交回复
热议问题