What is <discriminator > in Hibernate? How exactly
inheritance of Object to Tables can be done? What is the
benefits of discriminator?



What is <discriminator > in Hibernate? How exactly inheritance of Object to Tables can be do..

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

Post New Answer

More JDBC Interview Questions

Explain the steps in writing a java program using jdbc?

0 Answers  


What is jdbc servlet?

0 Answers  


Which interface is responsible for transaction management in jdbc?

0 Answers  


Can I use JDBC to execute non-standard features that my DBMS provides?

0 Answers  


Does JDBC support stored procedures?

0 Answers  






How to check jdbc driver version in websphere?

0 Answers  


What are clob and blob data types in jdbc?

0 Answers  


What is Apache DBCP API?

0 Answers  


What is the benefit of having jdbcrowset implementation?

0 Answers  


What is database deadlock ?

0 Answers  


what are the types of result sets in JDBC 3.0 ?

3 Answers   HCL,


How to move the cursor in scrollable resultset ?

0 Answers  


Categories