What is <discriminator > in Hibernate? How exactly
inheritance of Object to Tables can be done? What is the
benefits of discriminator?
Answer / haneef
Hi,
<discriminator> is useful, when you want to write a single
mapping file for the multiple pojo s which are under
inheritance.
Ex : Person<---Employee<----PermanentEmployee
<hibernate-mapping>
<class name="app.Person" table="ONE_PERSONS"
discriminator-value="p">
<id name="perId" column="PID">
<generator class="increment" />
</id>
<discriminator column="P_TYPE" />
<property name="perName" column="PNAME" />
<subclass name="app.Employee" discriminator-value="e">
<property name="empId" column="ENO" />
</subclass>
<subclass name="app.PermanentEmployee"
discriminator-value="pe">
<property name="allow" column="ALLOW" />
</subclass>
</class>
</hibernate-mapping>
| Is This Answer Correct ? | 6 Yes | 2 No |
What is a connection string used for?
What is metadata in programming?
What is CLOB and BLOB datatypes in JDBC?
How to find that, a row is updated or not?
What is the role of class.forname while loading drivers?
Why do you use a data source object for a connection?
how to prevent finally block from execution
State the different connection methods used for creating different types of sql.
how we can remove hard code in java?
Where is ojdbc14 jar located?
What are the jdbc api components?
What is JDBC Connection? Explain steps to get Database connection in a simple java program.