Hi Forum,
I'm trying to use @MappedSuperclass and @AttributeOverrides in this way:
@MappedSuperclass public abstract class SuperClass { @Id protected Long id; @Basic @Column(name = "aaa") protected String bbb; }
@Entity @Table(name = "SubTable") @AttributeOverrides({@AttributeOverride(name = "id", column = @Column(name = "SubID"))} public class SubClass { }
By table looks like: create table SubTable ( id serial, aaa varchar(255) );
But I got two problems: 1. AttributeOverride "id" had to add "insertable = false, updatable = false", otherwise, it will give "Repated mapping column in entity: xxxx" error. 2. Column name "aaa" not been used, system will use default column name "bbbb" instead of from @Column annotation. But the column name from AttributeOverrides been used. So, insert query become "insert into SubTable (id, bob) values (?, ?)".
For first, I can add "insertable = false, updatable = false". But what I did wrong with second one?
Thanks a lot
Noodle
|