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 difference between statement and preparedstatement in jdbc?
What is execute in java?
What does it mean to "materialize" data?
How can I write to the log used by DriverManager and JDBC drivers?
Define preparedstatement.
Does the database server have to be running Java or have Java support in order for my remote JDBC client app to access the database?
What is the significance of DataBaseMetaData.tableIndexStatistics? How to obtain and use it?
What is the use of jdbc?
What is JDBC Transaction Management and why do we need it?
Explain how to make updates to the updatable resultsets.
What is a jdbc driver and how many jdbc drivers are available?
Discuss the procedure of retrieving warnings?
What are the advantages of collection pools?
What is ojvm used for?
password, is stored in as plain text. What can I do to protect my passwords?