-Describe differences between Hibernate and JPA JPA is a standard (JEE) Hibernate is a JPA provider *** Hibernate provides additional features beyond the JPA standard Hibernate is a third-party framework We typically configure JPA with annotations, Hibernate with XML - What are the names for common Hibernate XML configuration files? hibernate.cfg.xml (if JPA persistence.xml) .hbm.xml - Hibernate programs can be portable across databases. What features of Hibernate contribute to that? HQL is portable Hibernate lets us specify a database "dialect" (like JDBC "adapter") - Hibernate programs can create queries and manage object state transitions like transient -> persistent. What Hibernate type lets us do that? Event e = new Event(); -- transient session.save(e); -- makes e "managed" - List at least three techniques that Hibernate provides so apps can issue queries. What are the advantages of each? HQL native SQL Criteria Query By Example Filter (controls the generated SQL adding additional predicate(s)) - Hibernate supports mapping inheritance hierarchies to the database. What are the strategies and their pros and cons? Single Table - Good: No joins needed - fast - Bad: have to NULLABLE columns, not normalized, discriminator Joined (table per class) - Good: Normalization, no discriminator Table per Concrete Class - Rarely used - Discuss the Hibernate entity lifecycle and its states. transient - not managed (new object) persistent - in the persistence context detached - not in PC; close session, evict(), clear() removed - marked for deletion - Hibernate entities must have a primary key. What are the options for keys that Hibernate supports? identity sequence assigned increment composite keys - Hibernate entities can have relationships. How do we implement such relationships in the database? unidirectional, bidirectional single value, multivalued foreign keys join table - Discuss syntax differences between Hibernate Query Language (HQL) and standard SQL. from Event (HQL) entity NAME! select * from events