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 is a jdbctemplate?
What are the different types of statements in jdbc?
Explain the difference between inner and outer join ?
What is use of connection pooling?
Does jdbc use ssl?
What is createstatement method in java?
What is the JDBC?
Why do you use a data source object for a connection?
Give an example for getXXX method?
What does executequery return in java?
What are different parts of a url?
How can you retrieve data from the resultset using jdbc?
What is an SQL Locator?
Define preparedstatement.
What is metadata in java programming?