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 does the connection object represents?
How can we disable a constraint ?
What are the different types of lockings in jdbc?
Explain different types of locks in jdbc?
What are the types of statements in jdbc?
What is odbc and jdbc in dbms?
Is jdbc a web technology?
What port does jdbc use?
How many types of jdbc drivers are there?
Which jdbc drivers will run your program?
What is db client?
Where jdbc drivermanager class is used?
What is setautocommit in jdbc?
When do we get java.sql.SQLException: No suitable driver found?
What is jdbc odbc in java?