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 phantom read and which isolation level prevents it?
what is the meaning of following code snippets Class c=class.forName(driverClassName); Driver d=(driver)c.newInstance();
Explain the importance of drivermanager.
Why do we use jdbc in java?
What is a JDBC 2.0 DataSource?
What are the different types of statements in jdbc?
Where is jdbc url mysql?
What is the difference between jdbc and jndi?
How many ways can you update a result set?
What are the different types of drivers under jdbc?
What is type 4 jdbc driver?
What is difference between java.util.Date and java.sql.Date?
What is the meaning of connection?
what happen if we set JDBC string to NULL?
Which interface handles transaction management in jdbc?