What is hibernate default inheritance strategy for bean mapped to database table?

This is my first request on stackoverflow and I think I provide all the resources needed:

I have provided my Java bean and database table below:

****** Java bean Class: ***

import java.sql.Timestamp;

import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.Id;

import javax.persistence.Table;

@Entity

@Table(name = "BANK_MESSAGES")

public class messagesBean implements Serializable

{

    @Id
    @Column(name="msg_id")
    private String msg_id;

    @Column(name="msg_date")
    Timestamp msgDateTime;

    @Column(name="message")
    private byte[] message;

    @Column(name="msg_type")
    private String msg_type;

    //Getters and Setters for the above fields
}

      

Below is the DDL for my database table (Oracle):

create table BANK_MESSAGES
(msg_id varchar2(10),
msg_date timestamp,
message blob,
msg_type varchar2(5)) ;

      

I'm trying to figure out what the default Inheritance strategy in hibernate is for a bean mapped to a database table as above?

+3


source to share


1 answer


If you only have one entity without any subclass, inheritance doesn't matter.

Otherwise the javadoc has an answer:



Annotation type Inheritance

@Target(value=TYPE)
@Retention(value=RUNTIME)
public @interface Inheritance

      

Defines the inheritance strategy to be used for the entity class hierarchy. It is specified in the entity class, which is the root of the entity class hierarchy. If the Inheritance annotation is not specified, or if the inheritance type is not specified for the entity class hierarchy, the SINGLE_TABLE matching strategy is used .

(emphasis mine).

+6


source







All Articles