What is <discriminator > in Hibernate? How exactly
inheritance of Object to Tables can be done? What is the
benefits of discriminator?
Answer Posted / 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 |
Post New Answer View All Answers
What are temp tables ?
What is jdbc odbc?
Discuss the significances of jdbc.
What is the limitation of PreparedStatement and how to overcome it?
What is JDBC Connection? Explain steps to get Database connection in a simple java program.
What is connection commit?
What are the new features added to JDBC 4.0?
How will you perform truncation using JDBC?
What do you understand by jdbc driver and explain its types?
What port does jdbc use?
What are jdbc?
Give an example of code used for setting up connection with a driver.
Is jpa faster than jdbc?
How can I connect mysql or oracle with java?
What is an SQL Locator?