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
Explain some new features available in jdbc 4.0?
Which Java and java.sql data types map to my specific database types?
How many ways that we can view a result set?
What is a jdbctemplate?
How do I check in my code whether a maximum limit of database connections have been reached?
What is the full form of jdbc?
What is the different between ResultSet and RowSet?
How many types of resultset are there in jdbc?
Why can't I invoke the ResultSet methods afterLast and beforeFirst when the method next works?
What are the different types of resultset?
What are the flow statements of jdbc?
Does JDBC support stored procedures?
What is createstatement method in java?
Name the new features added in jdbc 4.0.
How to connect multiple database in jdbc?