General
Design persistent classes
- Write code for getters, setters and constructor
- Identify correct implementation of equals() and hashcode()
- Describe the Primary Key mapping mechanism and needed syntax
- Explain mapping done using <id> element and @id annotation and corresponding relational structure
- Describe the following generator strategies : increment, identity, native, sequence.
- Name and explain the composite primary keys mapping strategies
- Explain The <composite-id> element and corresponding annotation
- Using an embedded composed primary key class
- Construct a Configuration object that initializes itself reading hibernate.properties, hibernate.cfg.xml
- Write a property-based and xml-based configuration file containing dialect and database connection information.
- Describe the semantics of the following methods : openSession(), close(), addClass()
- Establish the difference between the lifecycle of an Entity and a Type
- Write mapping file or annotation code that maps an Embedded Component in a POJO
- Identify correct Value Type collection mapping using <set>, <list>, <bag> and <map>
- Describe how to map a Component collection
- Given a hibernate collection mapping (xml or annotations) validate a corresponding relational model
- Describe Foreign Key mapping including
- simple reference <many-to-one>
- simple collection <one-to-many>, identify the following supported collection types <list>, <set>, <map>, <bag>
- bidirectional association and the meaning of the inverse attribute
- association table <many-to-many> mapping
- enhanced association Table, write code that use a composite-element to map an association table containing data
- Describe how to make hibernate constrain Foreign Key in one-to-one relationships
- Predict hibernate behaviour concerning cascading
- Identify the correct cascade attribute values and link them to the POJO lifecycle.
- Given code, establish what changes will be propagated to the database
- Troubleshoot performance problems using fetching and lazy loading principles (lazy & fetch attributes values)
- Table per subclass <joined-subclass/>
- Table per class hierarchy <discriminator/> <subclass/>
- Table per subclass with discriminator <discriminator/> <subclass/> <join/>
- Table per concrete class
- Table per concrete class with UNION <union-subclass>
- Explain pros and cons, basic knowledge of the different strategies and their differences
- Identify corresponding database structure
- Write code that establish a polymorphic association
- Identify entity States : persistent, transient, detached
- Describe State Transition API : clear(), close(), save(), saveOrUpdate(), persist(), evict(), merge(), contains(), delete() and update()
- Given code, identify when flushing is done.
- Explain the Dirty Checking mechanism
- describe and understand the basic principle
- establish how hibernate handles basic type and collection dirty checking
- Explain the purpose of the StatelessSession class
- Hibernate Query Language
- Write queries with basic syntax (from, select, where), sorting, aggregate functions
- Describe the Java object structure returned by queries such as
- select user from User as user
- select user, user.name from User as user
- Write code using the Session API that creates and execute queries
- Inject parameters values in where clauses : using Query.setXXX() methods
- Externalize queries in mapping files
- Query by Criterias and Query by Example
- Write code that executes a simple query (equivalent to select + where + sorting)
- Describe the purpose of the following related APIs : createCriteria(), Restrictions, Projections, Order, Criterion, Example, Example.create()
- Native SQL query
- Identify the 2 places where you define the SQL query string (hardcoded or externalized)
- Describe how to retrieve an externalized query using the Session API
- Write java code that use the Transaction object
- Start and End a transaction
- Test whether a transaction is active
- Rollback a transaction
- Write proper try-catch structure
- Identify Hibernate's implementations of the org.hibernate.Transaction interface
- Pessimistic Locking
- Write code that pessimistic-locks an entity using the related APIs Session.get()
- Identify the different LockModes
- Optimistic Locking
- Declare optimistic locking in mapping files <version> and <timestamp> and Annotations.
- Explain when a StaleObjectStateException can be thrown