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 types of resultset?
What is jdbc and why is it required?
What is jdbc and odbc?
How can we store and retrieve images from the database?
How many types of JDBC Drivers are present and what are they?
How can I retrieve a String or other object type without creating a new object each time?
Which database is used with java?
What is a jdbc connection?
What is difference between odbc and jdbc?
What is a lock in jdbc?
What is thin driver in jdbc?
How to know howmuch data is truncated?
Give an example for execution of sql statement.
What are the advantages of using preparedstatement in java?
What is metadata in java programming?