Mapping Java classes to database tables is implemented by
configuring an XML file or by using Java annotations. When using an XML file,
Hibernate can generate skeleton source code for persistence classes. This is an
auxiliary character when annotations are used. Hibernate can use the XML file
or Java annotations to maintain the schema of the database.
There are facilities for organizing one-to-many and
several-to-many relationships between classes. In addition to handling
associations between objects, Hibernate can also manage reflexive associations
in which an object has a one-to-many relationship with other instances of the
class type.
Hibernate supports mapping of custom value types. This makes
possible the following scenarios:
Replacing the default SQL type when mapping a column to a
property.
Mapping Java Enums to columns as if they were regular
properties.
Mapping a single property across multiple columns.
Definition: Objects in an object-oriented application follow
OOP principles, while background objects follow the principles of
standardization of the database, resulting in different representation
requirements. This problem is called "object relational impedance
mismatch". Mapping is a way to solve the object-relational incompatibility
problem.
Mapping informs the ORM tool of the Java class object to
store in which database table.
No comments:
Post a Comment