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 |
List some new features available in jdbc 4.0?
How to invoke Oracle Stored Procedure with Database Objects as IN/OUT?
What are types of resultset?
What is jndi lookup?
What is Type-3 Driver and when this driver is used?
Is jdbc part of j2ee?
How do I find ojdbc jar version?
Which constraint cannot be specified as an explicit constraint and should be specified with the column only ?
What is statement and preparedstatement in java?
how you will execute the many tables data
Can you define a foreign key, with a key from the same table?
What is the meaning of batch updates?