how to set @SequenceGenerator schema in multitenancy

旧城冷巷雨未停 提交于 2019-12-13 16:17:20

问题


I'm facing this issue, my entity Profile is :

@Entity
@Table(name="profile")
@Multitenant(value=MultitenantType.TABLE_PER_TENANT)
@TenantTableDiscriminator(type=TenantTableDiscriminatorType.SCHEMA, contextProperty="eclipselink.tenant-id")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING, length = 17)
public class Profile implements Serializable, Comparable<Profile> {

    private static final long serialVersionUID = 1L;

    @Id
    @SequenceGenerator(name = "profile_id_generator", sequenceName = "profile_identification_seq", allocationSize = 1, schema = ?)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "profile_id_generator")
    @Column(unique = true, nullable = false)
    @Expose
    private Integer identification;

Please, how can i set the schema in the @SequenceGenerator annotation according to the current user tenant-id

来源:https://stackoverflow.com/questions/43677932/how-to-set-sequencegenerator-schema-in-multitenancy

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