Why does eclipselink 2.5.0 does not support Override TableGenerator or SequenceGenerator in subclasses while hiberate does support?

隐身守侯 提交于 2019-12-11 03:39:51

问题


As titled.

Isn't it common to share Id definition in a base entity class? such as following:

@MappedSuperclass
public abstract class BaseEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE)
    private Long id;

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

    ...

}

While in subclass it is suppose to work as following:

@Entity
@Table(name = "sub_entity_table")
@TableGenerator(name = "SUB_ENTITY_SEQUENCE", initialValue = 1, allocationSize = 100)
public class SubEntity extends BaseEntity {
    ...
}

Since the GeneratedValue.generator is not specified, then the default value should be specified. The default generator name would be: a. The nearest upward TableGenerator definition from the entity class, just like inheritance. b. If situation in "a" does not exist, then use the literal value provided by JPA provider, such as SEQ_GEN_TABLE.

I love eclipseLink so much. I really hope to see this feature included in the next eclipselink release. :)

来源:https://stackoverflow.com/questions/18943310/why-does-eclipselink-2-5-0-does-not-support-override-tablegenerator-or-sequenceg

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!