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 |
What is database deadlock ?
What are the higher level apis under development on top of jdbc currently?
What are the considerations for deciding on transaction boundaries?
What type of driver you use in real-time projects?
How does jdbc connect to database?
How to store images in database?
Define preparedstatement.
How can I use the JDBC API to access a desktop database like Microsoft Access over the network?
Is possible to open a connection to a database with exclusive mode with JDBC?
How transactions are performed using JDBC ?
How can you tune SQL statements?
Which jdbc driver is the fastest driver?