Add a specific relationship in subclass annotated DiscriminatorValue

I have a question, I add an example with a view to explaining :

I have a table named “A” with attributes :

  • id
  • typeA (column discriminator )
  • id_entity_link

I want to do these SQL instructions :

>>> Jointure on table X with attribute id_entity_link of table A only if attribute typeA is equals to A1 : 

select * from A a
inner join X x on a.id_entity_link = x.id  and a.typeA='A1' 

>>> Jointure on table Y with attribute id_entity_link of table A only if attribute typeA is equals to A2 : 

select * from A a
inner join Y y on a.id_entity_link = y.id  and a.typeA='A2'

Actually, I have this implementation :

    @Entity(name = "A")
    @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
    @DiscriminatorColumn(
    discriminatorType = DiscriminatorType.STRING, name = "typeA")
    @Table(name = "A")
    public abstract class A {

       @Column(name = "id")
       @Id
       @GeneratedValue
       private int identifier;

       private int id_entity_link;
    }
    @DiscriminatorValue("A1")
    public class A1 extends A {

        // The jointure on table X via id_entity_link must be done only if typeA = "A1" 
        @ManyToOne
        @JoinColumn(name="id_entity_link", referencedColumnName="id"))
        private X x;
    }

How can I specifiy that the jointure between tables A and X is only available if the attribute “typeA” is equals to A1 ?

    @DiscriminatorValue("A2")
    public class A2 extends A {

        // The jointure on table Y via id_entity_link must be done only if typeA = "A2"
        @ManyToOne
        @JoinColumn(name="id_entity_link", referencedColumnName="id"))
        private Y y;
    }

How can I specifiy that the jointure between tables A and Y is only available if the attribute “typeA” is equals to A2 ?

And it exists an another class with discriminator value equals to “A3” and has no jointure.

    @DiscriminatorValue("A3")
    public class A3 extends A {

        // No jointure on any table 
    }

This class has no jointure with another class.

Thanks for your answer