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. :)