Architecture, Configuration, Dependencies, Annotations and SessionFactory
Learn Architecture, Configuration, Dependencies, Annotations and SessionFactory (Phase 1 · Hibernate Fundamentals (Core), Hibernate) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Hibernate architecture • Your application talks to the persistence API ( EntityManager / Session ). Core objects: SessionFactory (heavyweight, thread-safe, one per database, built once at startup; holds metadata, SQL cache, second-level cache config), Session (lightweight, not thread-safe, one unit of work, wraps a JDBC connection and holds the persistence context = first-level cache), Transaction , and query objects. • Below sit the mapping metadata (annotations), the dialect (database-specific SQL), the connection provider (pool) and JDBC . Hibernate translates entity operations into SQL,...