Subclass in Hibernate: We use the table-per-class hierarchy mapping strategy, the <subclass> declaration is used. In hibernate Polymorphic persistence requires the declaration of each subclass of the root persistent class.
For this we take a example which is given below:
<subclass
name="ClassName"
discriminator-value="discriminator_value"
proxy="ProxyInterface"
lazy="true|false"
dynamic-update="true|false" dynamic-insert="true|false" entity-name="EntityName" node="element-name" extends="SuperclassName"> <property .... /> ..... </subclass>
Tag Description is given below:
Tag |
Description |
name |
fully qualified class name of the subclass |
discriminator-value(optional) |
defaults to the class name. value that distinguishes individual subclasses |
proxy (optional) |
specifies a class or interface used for lazy initializing proxies |
lazy (optional) |
defaults to true. setting lazy="false" disables the use of lazy fetching |