What is <discriminator > in Hibernate? How exactly
inheritance of Object to Tables can be done? What is the
benefits of discriminator?
Answer / 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 |
Why is odbc needed?
What are the different classes through which JDBC represents statements?
what is CallableStatement and what is its usage?
How do we call a stored procedure from jdbc?
What is correlated subquery?
0 Answers emc2, JK Technosoft,
What is a JDBC 2.0 DataSource?
What is an outer join?
What is JDBC ResultSet?
What is JDBC Driver interface?
Why should we close database connections in java?
Which type of driver provides jdbc access via one or more odbc drivers?
What is de-normalization?