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 do you mean by two phase commits?
How does jdbc driver work?
What are the methods which can verify the cursor particular position?
What is the difference between jdbc and jndi?
Is not bound in this context unable to find jdbc spring boot?
What is isolation level? How to set it?
What is represented by the connection object?
Explain about Join?
How do I insert an image file (or other raw data) into a database?
How do I know which jdbc driver to use?
What are dml and ddl?
Which type of driver is unique in jdbc?
Is jdbc a web technology?
How to connect multiple database in jdbc?
What is a jdbc driver and how many jdbc drivers are available?