2

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

alveomaster
  • 1,681
  • 2
  • 12
  • 21
  • 1
    ok in the meantime, the easy way that i find is to update schema to suit the current tenant at the beginning of every transaction `SET search_path TO tenant` – alveomaster May 04 '17 at 06:44

0 Answers0