how to override id in hibernate with annotation with inhertance

Viewed 32

I have a super class that not map in hibernate.

@MappedSuperclass
public class Parent {

    Long id;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    
}

and i have another class that extended this superclass and and map in hibernate.

@Entity 
@Table(name = "childe1")
public class Person extends Base {
    
@Id
    @SequenceGenerator(sequenceName = "childe1",name = "seq1" )
    @GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "seq1")
    
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
}

i want Childe1 class use seq1 for id , but this not work.

can you help me? thanks

0 Answers
Related