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
How you restrict a user to cut and paste from the html page using java programing?
What is database connection pooling? Advantages of using a connection pool?
How do I find jdbc version?
Explain in detail about JDBC and its general features?
Can I use JDBC to execute non-standard features that my DBMS provides?
If I use the JDBC API, do I have to use ODBC underneath?
Is jdbc and orm?
Give a way to check that all result sets have bin accessed and update counts are generated by execute method.
What do you understand by jdbc driver and explain its types?
What is the JDBC?
What is metadata in jdbc?
What does the jdbc resultsetmetadata interface?
What is jdbc url for mysql?
What is metadata in programming?
What is jdbc driver for sql server?