TABLE_PER_CLASS exclude superclass

Parent table and class

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Table(name = "vehicle")
public class Vehicle extends Entity {
    // Attributes
}

create table vehicle
(
    id varchar2(50) not null,
    // Attributes
)tablespace :TABLESPACE_DATA ;

Child 1 table and class

@Entity
@Table(name = "car")
public class Car extends Vehicle {
    // Attributes
}

create table car
(
    // Attributes
) inherits (vehicle) tablespace :TABLESPACE_DATA ;

Child 2 table and class

@Entity
@Table(name = "bus")
public class Bus extends Vehicle {
    // Attributes
}

create table bus
(
    // Attributes
) inherits (vehicle) tablespace :TABLESPACE_DATA ;

If I add a new Car, then there will be one record which can be visible from both tables (Vehicle & Car)

Then with a Hibernate generated query by id for the Vehicle (check below) it will return with two rows, which cause an exception.

select
    // ...
from
    (
        select
            id,
            //
            0 as clazz_
        from
            VEHICLE
        union all
        select
            id,
            //
            1 as clazz_
        from
            car
        union all
        select
            id,
            //
            2 as clazz_
        from
            bus
    ) vehicle0_
where
    vehicle0_.id = ?

The main problem is that the Hibernate include the parent class as well. This can be resolved if the parent class is abstract. Is there any other way to avoid the union of parent?

Hibernate is doing exactly what you told it to do. For every non-abstract entity class it will map to a corresponding table. If you load an entity A, Hibernate has to return also all possible subtypes. On the other hand, if you query for a specific entity type like Car, Hibernate will only query that table. Vehicle is special though and to be honest, the mapping is strange. It seems to me that this is a mix of table per class and joined. Making Vehicle abstract is probably the best way to solve this.