Hibernate is a Java framework that simplifies the development of Java application to interact with the database. Hibernate was started in 2001 by Gavin King as an alternative to EJB style Entity Bean. Hibernate is an Open Source, Lightweight, ORM (Object Relational Mapping) Tool. Hibernate implements the specifications of JPA (Java Persistence API) for data persistence.
An ORM (Object Relational Mapping) Tool simplifies the Data Creation, Data Manipulation and Data Access. Hibernate is a programming technique that maps the object to the data stored in the database. The ORM Tool internally uses the JDBC API to interact with the database.
An Java Persistence API (JPA) is a Java specification that provides certain functionality and standard to ORM tools. The javax.persistence package contains the JPA classes and interfaces.
| Open Source and Lightweight | Hibernate framework is open source under the LGPL (Lesser General Public Liceense) and lightweight. |
| Fast Performance | The performance of hibernate framework is fast because cache is internally used in hibernate framework. There are two types of cache in hibernate framework first level cache and second level cache. First level cache is enabled by default. |
| Database Independent Query | HQL (Hibernate Query Language) is the object-oriented version of SQL. HQL generates the database independent queries. So you don't need to write database specific queries. |
| Automatic Table Creation | Hibernate framework provides the facility to create the tables of the database automatically. So there is no need to create tables in the database manually. |
| Simplifies Complex Join | Fetching data from multiple tables is easy in hibernate framework. |
| Provides Query Statistics and Database Status | Hibernate supports Query cache and provide statistics about query and database status. |
We create an object of an entity and save it into the database or we fetch the data of an entity from the database. Each entity is associated with the lifecycle. The entity object passes through the 3 stages of the lifecycle.
1. Transient State
2. Persistent State
3. Detached State
| Transient State |
|---|
| 1. The transient state is the initial state of an object. |
| 2. Once we create an instance of POJO class, then the object entered in the transient state. |
| 3. An object is not associated with the Session. So, the transient state is not related to any database. |
| 4. Modifications in the data don't affect any changes in the database. |
| 5. The transient objects exist in the heap memory. They are independent of Hibernate. |
| Persistent State |
| 1. As soon as the object associated with the Session, it entered in the persistent state. |
| 2. Hence, we can say that an object is in the persistence state when we save or persist it. |
| 3. Here, each object represents the row of the database table. |
| 4. So, modifications in the data make changes in the database. |
| Detached State |
| 1. Once we either close the session or clear its cache, then the object entered into the detached state. |
| 2. As an object is no more associated with the Session, modifications in the data don't affect any changes in the database. |
| 3. However, the detached object still has a representation in the database. |
| 4. If we want to persist the changes made to a detached object, it is required to reattach the application to a valid Hibernate session. |
| 5. To associate the detached object with the new hibernate session, use any of these methods - load(), merge(), refresh(), update() or save() on a new session with the reference of the detached object. |
The Generator Class is a sub-element of id. It is used to generate the unique identifier for the objects of persistent class. There are many generator classes defined in the Hibernate Framework.
All the Generator Class implements the org.hibernate.id.IdentifierGenerator Interface . The application programmer may create one's own generator classes by implementing the IdentifierGenerator interface. Hibernate framework provides many built-in generator classes:
| 1. | assigned is the default generator strategy if there is no ≤ generator≥ element . In this case, application assigns the id. |
| 2. | increment generates the unique id only if no other process is inserting data into this table. It generates short, int or long type identifier. If a table contains an identifier then the application considers its maximum value else the application consider that the first generated identifier is 1. For each attribute value, the hibernate increment the identifier by 1. |
| 3. | sequence uses the sequence of the database. if there is no sequence defined, it creates a sequence automatically e.g. in case of Oracle database, it creates a sequence named HIBERNATE_SEQUENCE. In case of Oracle, DB2, SAP DB, Postgre SQL or McKoi, it uses sequence but it uses generator in interbase. |
| 4. | hilo It uses high and low algorithm to generate the id of type short, int and long. |
| 5. | native uses identity, sequence or hilo depending on the database vendor. |
| 6. | identity is used in Sybase, My SQL, MS SQL Server, DB2 and HypersonicSQL to support the id column. The returned id is of type short, int or long. It is responsibility of database to generate unique identifier. |
| 7. | seqhilo uses high and low algorithm on the specified sequence name. The returned id is of type short, int or long. |
| 8. | uuid uses 128-bit UUID algorithm to generate the id. The returned id is of type String, unique within a network (because IP is used). The UUID is represented in hexadecimal digits, 32 in length. |
| 9. | guid uses GUID generated by database of type string. It works on MS SQL Server and MySQL. |
| 10. | select uses the primary key returned by the database trigger. |
| 11. | foreign uses the id of another associated object, mostly used with ≤ one-to-one≥ association. |
| 12. | sequence-identity uses a special sequence generation strategy. It is supported in Oracle 10g drivers only. |
The dialect specifies the type of database used in hibernate so that hibernate generate appropriate type of SQL statements. For connecting any hibernate application with the database, it is required to provide the configuration of SQL dialect.
Syntax of SQL Dialect
| RDBMS | Dialect |
|---|---|
| Oracle | org.hibernate.dialect.OracleDialect |
| Oracle9i | org.hibernate.dialect.Oracle9iDialect |
| Oracle10g | org.hibernate.dialect.Oracle10gDialect |
| MySQL | org.hibernate.dialect.MySQLDialect |
| MySQL with InnoDB | org.hibernate.dialect.MySQLInnoDBDialect |
| MySQL with MyISAM | org.hibernate.dialect.MySQLMyISAMDialect |
| DB2 | org.hibernate.dialect.DB2Dialect |
| DB2 AS/400 | org.hibernate.dialect.DB2400Dialect |
| DB2 OS390 | org.hibernate.dialect.DB2390Dialect |
| Microsoft SQL Server | org.hibernate.dialect.SQLServerDialect |
| Sybase | org.hibernate.dialect.SybaseDialect |
| Sybase Anywhere | org.hibernate.dialect.SybaseAnywhereDialect |
| PostgreSQL | org.hibernate.dialect.PostgreSQLDialect |
| SAP DB | org.hibernate.dialect.SAPDBDialect |
| Informix | org.hibernate.dialect.InformixDialect |
| HypersonicSQL | org.hibernate.dialect.HSQLDialect |
| Ingres | org.hibernate.dialect.IngresDialect |
| Progress | org.hibernate.dialect.ProgressDialect |
| Mckoi SQL | org.hibernate.dialect.MckoiDialect |
| Interbase | org.hibernate.dialect.InterbaseDialect |
| Pointbase | org.hibernate.dialect.PointbaseDialect |
| FrontBase | org.hibernate.dialect.FrontbaseDialect |
| Firebird | org.hibernate.dialect.FirebirdDialect |
We can map the inheritance hierarchy classes with the table of the database. There are three inheritance mapping strategies defined in the hibernate:.
| 1. Table Per Hierarchy | Single Table is required to map the whole hierarchy, an extra column (known as discriminator column) is added to identify the class. But nullable values are stored in the table . |
| 2. Table Per Concrete class | Tables are created as per class. But duplicate column is added in subclass tables. |
| 3. Table Per Subclass | Tables are created as per class but related by foreign key. So there are no duplicate columns. |
Hibernate caching improves the performance of the application by pooling the object in the cache.
It is useful when we have to fetch the same data multiple times.
| 1. First Level Cache | Session object holds the First Level Cache data. The First Level Cache is enabled by default. The First Level Cache data will not be available to entire application. An application can use many session object. |
| 2. Second Level Cache | SessionFactory object holds the Second Level Cache data. The data stored in the Second Level Cache will be available to entire application. Second Level Cache need to enable it explicitely. Different vendors have provided the implementation of Second Level Cache. 1. EH (Easy Hibernate) Cache 2. Swarm Cache 3. OS Cache 4. JBoss Cache |
Hibernate second level cache uses a common cache for all the session object of a session factory. It is useful if you have multiple session objects from a session factory. SessionFactory holds the second level cache data. It is global for all the session objects and not enabled by default.
| 1. read-only caching will work for read only operation. caching will work for read only operation. |
| 2. nonstrict-read-write caching will work for read and write but one at a time. |
| 3. read-write caching will work for read and write, can be used simultaneously. |
| 4. transactional caching will work for transaction. |
| Implementation | read-only | nonstrict-read-write | read-write | transactional |
|---|---|---|---|---|
| EH Cache | Yes | Yes | Yes | No |
| OS Cache | Yes | Yes | Yes | No |
| Swarm Cache | Yes | Yes | No | No |
| JBoss Cache | No | No | No | Yes |
Get Method and Load Method are two methods which is used to fetch data for the given identifier. They both belong to Hibernate Session class. Get Method return null, If no row is available in the session cache or the database for the given identifier whereas Load method throws object not found exception.
| Key | Get Method | Load Method |
|---|---|---|
| Basic | It is used to fetch data from the database for the given identifier | It is also used to fetch data from the database for the given identifier |
| Null Object | It object not found for the given identifier then it will return null object | It will throw object not found exception |
| Lazy or Eager loading | It returns fully initialized object so this method eager load the object | It always returns proxy object so this method is lazy load the object |
| Performance | It is slower than Load Method because it return fully initialized object which impact the performance of the application | It is slightly faster. |
| Use Case | If you are not sure that object exist then use Get Method | If you are sure that object exist then use Load Method |
Save Method and Persist Method both methods are used for saving object in the database.
Save Method Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.) This operation cascades to associated instances if the association is mapped with cascade="save-update".
Persist Method Make a transient instance persistent. This operation cascades to associated instances if the association is mapped with cascade="persist". The semantics of this method are defined by JSR-220.
| Key | Save Method | Persist Method |
|---|---|---|
| Basic | It stores object in database | It also stores object in database |
| Return Type | It return generated id and return type is serializable | It does not return anything. Its void return type. |
| Transaction Boundaries | It can save object within boundaries and outside boundaries | It can only save object within the transaction boundaries |
| Detached Object | It will create a new row in the table for detached object | It will throw persistence exception for detached object |
| Supported by | It is only supported by Hibernate | It is also supported by JPA |
Definition:Hibernate delays the loading of related entities until they are actually accessed in your code.
| Advantages |
|---|
| 1. Reduced Memory Consumption: Only loads the data that is immediately needed, saving memory. |
| 2. Fewer Initial Queries: Reduces the initial number of database queries. |
| Disadvantages |
| 1. Potential for "N+1" Problem: If you access a collection of related entities in a loop, it can lead to multiple database queries (one for the parent and one for each related entity). |
| 2. LazyInitializationException: Can occur if you try to access a lazy-loaded entity outside of a Hibernate session. |
| When to Use |
| 1. When you don't always need related data. |
| 2. When related entities are large and not always required. |
| 3. When you want to minimize initial database load. |
Definition: Hibernate fetches all associated entities when the parent entity is loaded
| Advantages |
|---|
| 1. Reduced Database Queries: All related data is fetched in a single query, potentially improving performance. |
| 2. Simplified Code: You don't need to worry about accessing related entities outside of a session. |
| Disadvantages |
| 1.Increased Memory Consumption: Loads all related data into memory, even if it's not used. |
| 2. More Initial Queries: Can lead to more database queries if the parent entity is frequently accessed with related data that is not always needed. |
| When to Use |
| 1. When you always need related data. |
| 2. When you want to minimize database round trips. |
| 3. When you are sure that the related data will be used. |
Lazy and Eager are two types of data loading strategies in ORMs such as hibernate and eclipse Link. These data loading strategies we used when one entity class is having references to other Entities like Student and Address (Address in the Student).
These data loading strategies we used when one entity class is having references to other Entities like Student and Address (Address in the Student).
| Key | Lazy | Eager |
|---|---|---|
| Fetching strategy | In Lazy loading, associated data loads only when we explicitly call getter or size method. | In Eager loading, data loading happens at the time of their parent is fetched |
| Default Strategy | ManyToMany and OneToMany associations used lazy loading strategy by default. | ManyToOne and OneToOne associations used lazy loading strategy by default. |
| Loading Configurations | It can be enabled by using the annotation parameter : fetch = FetchType.LAZY | It can be enabled by using the annotation parameter : fetch = FetchType.EAGER |
| Performance | Initial load time much smaller than Eager loading | Loading too much unnecessary data might impact performance |
| @AccessType | The @AccessType annotation is deprecated. You should use either the JPA @Access or the Hibernate native @AttributeAccessor annotation. |
| @Any | The @Any annotation is used to define the any-to-one association which can point to one one of several entity types. |
| @AnyMetaDef | The @AnyMetaDef annotation is used to provide metadata about an @Any or @ManyToAny mapping. |
| @AnyMetaDefs | The @AnyMetaDefs annotation is used to group multiple @AnyMetaDef annotations. |
| @AttributeAccessor | The @AttributeAccessor annotation is used to specify a custom PropertyAccessStrategy. Should only be used to name a custom PropertyAccessStrategy. For property/field access type, the JPA @Accessannotation should be preferred. However, if this annotation is used with either value="property" or value="field", it will act just as the corresponding usage of the JPA @Access annotation. |
| @BatchSize | The @BatchSize annotation is used to specify the size for batch loading the entries of a lazy collection. |
| @Cache | The @Cache annotation is used to specify the CacheConcurrencyStrategy of a root entity or a collection. |
| @Cascade | The @Cascade annotation is used to apply the Hibernate specific CascadeType strategies (e.g. CascadeType.LOCK, CascadeType.SAVE_UPDATE, CascadeType.REPLICATE) on a given association. For JPA cascading, prefer using the javax.persistence.CascadeType instead. When combining both JPA and Hibernate CascadeType strategies, Hibernate will merge both sets of cascades. |
| @Check | The @Check annotation is used to specify an arbitrary SQL CHECK constraint which can be defined at the class level. |
| @CollectionId | The @CollectionId annotation is used to specify an identifier column for an idbag collection. You might want to use the JPA @OrderColumn instead. |
| @CollectionType | The @CollectionType annotation is used to specify a custom collection type. The collection can also name a @Type, which defines the Hibernate Type of the collection elements. |
| @ColumnDefault | The @ColumnDefault annotation is used to specify the DEFAULT DDL value to apply when using the automated schema generator. The same behavior can be achieved using the definition attribute of the JPA @Column annotation. |
| @Columns | The @Columns annotation is used to group multiple JPA @Column annotations. |
| @ColumnTransformer | The @ColumnTransformer annotation is used to customize how a given column value is read from or write into the database. |
| @ColumnTransformers | The @ColumnTransformers annotation is used to group multiple @ColumnTransformer annotations. |
| @CreationTimestamp | The @CreationTimestamp annotation is used to specify that the currently annotated temporal type must be initialized with the current JVM timestamp value. |
| @DiscriminatorFormula | The @DiscriminatorFormula annotation is used to specify a Hibernate @Formula to resolve the inheritance discriminator value. |
| @DiscriminatorOptions | The @DiscriminatorOptions annotation is used to provide the force and insert Discriminator properties. |
| @DynamicInsert | The @DynamicInsert annotation is used to specify that the INSERT SQL statement should be generated whenever an entity is to be persisted. Hibernate uses a cached INSERT statement that sets all table columns. When the entity is annotated with the @DynamicInsert annotation, the PreparedStatement is going to include only the non-null columns. |
| @DynamicUpdate | The @DynamicUpdate annotation is used to specify that the UPDATE SQL statement should be generated whenever an entity is modified. Hibernate uses a cached UPDATE statement that sets all table columns. When the entity is annotated with the @DynamicUpdate annotation, the PreparedStatement is going to include only the columns whose values have been changed. |
| @Entity | The @Entity annotation is deprecated. Use the JPA @Entity annotation instead. |
| @Fetch | The @Fetch annotation is used to specify the Hibernate specific FetchMode (e.g. JOIN, SELECT, SUBSELECT) used for the currently annotated association: |
| @FetchProfile | The @FetchProfile annotation is used to specify a custom fetching profile, similar to a JPA Entity Graph. |
| @FetchProfile.FetchOverride | The @FetchProfile.FetchOverride annotation is used in conjunction with the @FetchProfile annotation, and it’s used for overriding the fetching strategy of a particular entity association. |
| @FetchProfiles | The @FetchProfiles annotation is used to group multiple @FetchProfile annotations. |
| @Filter | The @Filter annotation is used to add filters to an entity or the target entity of a collection. |
| @FilterDef | The @FilterDef annotation is used to specify a @Filter definition (name, default condition and parameter types, if any). |
| @FilterDefs | The @FilterDefs annotation is used to group multiple @FilterDef annotations. |
| @FilterJoinTable | The @FilterJoinTable annotation is used to add @Filter capabilities to a join table collection. |
| @FilterJoinTables | The @FilterJoinTables annotation is used to group multiple @FilterJoinTable annotations. |
| @Filters | The @Filters annotation is used to group multiple @Filter annotations. |
| @ForeignKey | The @ForeignKey annotation is deprecated. Use the JPA 2.1 @ForeignKey annotation instead. |
| @Formula | The @Formula annotation is used to specify an SQL fragment that is executed in order to populate a given entity attribute. |
| @Generated | The @Generated annotation is used to specify that the currently annotated entity attribute is generated by the database. |
| @GeneratorType | The @GeneratorType annotation is used to provide a ValueGenerator and a GenerationTime for the currently annotated generated attribute. |
| @GenericGenerator | The @GenericGenerator annotation can be used to configure any Hibernate identifier generator. |
| @GenericGenerators | The @GenericGenerators annotation is used to group multiple @GenericGenerator annotations.@Immutable The @Immutable annotation is used to specify that the annotated entity, attribute, or collection is immutable. |
| @Index | The @Index annotation is deprecated. Use the JPA @Index annotation instead. |
| @IndexColumn | The @IndexColumn annotation is deprecated. Use the JPA @OrderColumn annotation instead. |
| @JoinColumnOrFormula | The @JoinColumnOrFormula annotation is used to specify that the entity association is resolved either through a FOREIGN KEY join (e.g. @JoinColumn) or using the result of a given SQL formula (e.g. @JoinFormula). |
| @JoinColumnsOrFormulas | The @JoinColumnsOrFormulas annotation is used to group multiple @JoinColumnOrFormula annotations. |
| @JoinFormula | The @JoinFormula annotation is used as a replacement for @JoinColumn when the association does not have a dedicated FOREIGN KEY column. |
| @LazyCollection | The @LazyCollection annotation is used to specify the lazy fetching behavior of a given collection. The TRUE and FALSE values are deprecated since you should be using the JPA FetchType attribute of the @ElementCollection, @OneToMany, or @ManyToMany collection. The EXTRA value has no equivalent in the JPA specification, and it’s used to avoid loading the entire collection even when the collection is accessed for the first time. Each element is fetched individually using a secondary query. |
| @LazyGroup | The @LazyGroup annotation is used to specify that an entity attribute should be fetched along with all the other attributes belonging to the same group. To load entity attributes lazily, bytecode enhancement is needed. By default, all non-collection attributes are loaded in one group named "DEFAULT". This annotation allows defining different groups of attributes to be initialized together when access one attribute in the group. |
| @LazyToOne | The @LazyToOne annotation is used to specify the laziness options, represented by LazyToOneOption, available for a @OneToOne or @ManyToOne association. |
| @ListIndexBase | The @ListIndexBase annotation is used to specify the start value for a list index, as stored in the database. List indexes are stored starting at zero. Generally used in conjunction with @OrderColumn. |
| @Loader | The @Loader annotation is used to override the default SELECT query used for loading an entity loading. |
| @ManyToAny | The @ManyToAny annotation is used to specify a many-to-one association when the target type is dynamically resolved. |
| @MapKeyType | The @MapKeyType annotation is used to specify the map key type. |
| @MetaValue | The @MetaValue annotation is used by the @AnyMetaDef annotation to specify the association between a given discriminator value and an entity type. |
| @NamedNativeQueries | The @NamedNativeQueries annotation is used to group multiple @NamedNativeQuery annotations. |
| @NamedNativeQuery | The @NamedNativeQuery annotation extends the JPA @NamedNativeQuery with Hibernate specific features. |
| @NamedQueries | The @NamedQueries annotation is used to group multiple @NamedQuery annotations. |
| @NamedQuery | The @NamedQuery annotation extends the JPA @NamedQuery with Hibernate specific features. |
| @Nationalized | The @Nationalized annotation is used to specify that the currently annotated attribute is a character type (e.g. String, Character, Clob) that is stored in a nationalized column type (NVARCHAR, NCHAR, NCLOB). |
| @NaturalId | The @NaturalId annotation is used to specify that the currently annotated attribute is part of the natural id of the entity. |
| @NaturalIdCache | The @NaturalIdCache annotation is used to specify that the natural id values associated with the annotated entity should be stored in the second-level cache. |
| @NotFound | The @NotFound annotation is used to specify the NotFoundAction strategy for when an element is not found in a given association. |
| @OnDelete | The @OnDelete annotation is used to specify the delete strategy employed by the currently annotated collection, array or joined subclasses. This annotation is used by the automated schema generation tool to generate the appropriate FOREIGN KEY DDL cascade directive. |
| @OptimisticLock | The @OptimisticLock annotation is used to specify if the currently annotated attribute will trigger an entity version increment upon being modified. |
| @OrderBy | The @OrderBy annotation is used to specify a SQL ordering directive for sorting the currently annotated collection. It differs from the JPA @OrderBy annotation because the JPA annotation expects a JPQL order-by fragment, not an SQL directive. |
| @ParamDef | The @ParamDef annotation is used in conjunction with @FilterDef so that the Hibernate Filter can be customized with runtime-provided parameter values. |
| @Parameter | The @Parameter annotation is a generic parameter (basically a key/value combination) used to parametrize other annotations, like @CollectionType, @GenericGenerator, and @Type, @TypeDef. |
| @Parent | The @Parent annotation is used to specify that the currently annotated embeddable attribute references back the owning entity. |
| @Persister | The @Persister annotation is used to specify a custom entity or collection persister. For entities, the custom persister must implement the EntityPersister interface. For collections, the custom persister must implement the CollectionPersister interface. |
| @Polymorphism | The @Polymorphism annotation is used to define the PolymorphismType Hibernate will apply to entity hierarchies. |
| @Proxy | The @Proxy annotation is used to specify a custom proxy implementation for the currently annotated entity. |
| @RowId | The @RowId annotation is used to specify the database column used as a ROWID pseudocolumn. For instance, Oracle defines the ROWID pseudocolumn which provides the address of every table row. |
| @SelectBeforeUpdate | The @SelectBeforeUpdate annotation is used to specify that the currently annotated entity state be selected from the database when determining whether to perform an update when the detached entity is reattached. |
| @Sort | The @Sort annotation is deprecated. Use the Hibernate specific @SortComparator or @SortNatural annotations instead. |
| @SortComparator | The @SortComparator annotation is used to specify a Comparator for sorting the Set/Map in-memory. |
| @SortNatural | The @SortNatural annotation is used to specify that the Set/Map should be sorted using natural sorting. |
| @Source | The @Source annotation is used in conjunction with a @Version timestamp entity attribute indicating the SourceTypeof the timestamp value. |
| @SQLDelete | The @SQLDelete annotation is used to specify a custom SQL DELETE statement for the currently annotated entity or collection. |
| @SQLDeleteAll | The @SQLDeleteAll annotation is used to specify a custom SQL DELETE statement when removing all elements of the currently annotated collection. |
| @SqlFragmentAlias | The @SqlFragmentAlias annotation is used to specify an alias for a Hibernate @Filter. The alias (e.g. myAlias) can then be used in the @Filter condition clause using the {alias} (e.g. {myAlias}) placeholder. |
| @SQLInsert | The @SQLInsert annotation is used to specify a custom SQL INSERT statement for the currently annotated entity or collection. |
| @SQLUpdate | The @SQLUpdate annotation is used to specify a custom SQL UPDATE statement for the currently annotated entity or collection. |
| @Subselect | The @Subselect annotation is used to specify an immutable and read-only entity using a custom SQL SELECT statement. |
| @Synchronize | The @Synchronize annotation is usually used in conjunction with the @Subselect annotation to specify the list of database tables used by the @Subselect SQL query. |
| @Table | The @Table annotation is used to specify additional information to a JPA @Table annotation, like custom INSERT, UPDATE or DELETE statements or a specific FetchMode. |
| @Tables | The @Tables annotation is used to group multiple @Table annotations. |
| @Target | The @Target annotation is used to specify an explicit target implementation when the currently annotated association is using an interface type. |
| @Tuplizer | The @Tuplizer annotation is used to specify a custom tuplizer for the currently annotated entity or embeddable. |
| @Tuplizers | The @Tuplizers annotation is used to group multiple @Tuplizer annotations. |
| @Type | The @Type annotation is used to specify the Hibernate @Type used by the currently annotated basic attribute. |
| @TypeDef | The @TypeDef annotation is used to specify a @Type definition which can later be reused for multiple basic attribute mappings. |
| @TypeDefs | The @TypeDefs annotation is used to group multiple @TypeDef annotations. |
| @UpdateTimestamp | The @UpdateTimestamp annotation is used to specify that the currently annotated timestamp attribute should be updated with the current JVM timestamp whenever the owning entity gets modified. |
| @ValueGenerationType | The @ValueGenerationType annotation is used to specify that the current annotation type should be used as a generator annotation type. |
| @Where | The @Where annotation is used to specify a custom SQL WHERE clause used when fetching an entity or a collection. |
| @WhereJoinTable | The @WhereJoinTable annotation is used to specify a custom SQL WHERE clause used when fetching a join collection |