Submitted by sneha on Sun, 04/15/2018 - 08:06
Submitted by sneha on Sun, 04/15/2018 - 08:05
When you load an embeding class, it may load its embedded collections either lazily or eagerly.
Important points about eager and lazy fetch types in Hibernate
By default, when you load an embedding class (E.g. User or Company) using session.get,
The embedded collection is actually retrieved when you call the getter for that embedded collection.
Submitted by sneha on Sun, 04/15/2018 - 06:11
There might be situations where you would want to modify the attributes of the embedded class (eg. Address) within an embedding class (eg. User), for instance, changing the database column name for a field.
We can use @AttributeOverride annotation to override the details of a field of the embedded class and then enclose all such @AttributeOverride annotations inside @AttributeOverrides annotation. [node:read-more:link]
Submitted by sneha on Sun, 04/15/2018 - 06:10
A value type is a type which doesn't have existence of its own, but belongs to an entity, like an user and his address. Value types are always completely owned by their containing entity.
We will embed an Address class inside a User class. The simplest way to embed a value type in an entity class is to treat the member variables of the embedded class (e.g. Address), the same way as we treat the member variables of the embedding class (e.g. User) by adding more columns to the entity table one column each for the value type class members [node:read-more:link]
Submitted by sneha on Sun, 04/15/2018 - 06:09