Does org.hibernate.MultiTenancyStrategy#DISCRIMINATOR has improved?

Description

Hi:
I have see any demo for the multiTenant of mutiple database. But can't solve my problem because I have only single database and all tables have tencent column to choose it. I had see hibernate 5 supported
MultiTenancyStrategy#DISCRIMINATOR but i don't see any demo or code to show it? `AbstractDataSourceBasedMultiTenantConnectionProviderImpl` is used to choose database. but i want to use a column like it.
I had use filter to appove it. but i think it's not a correct solution.
The base entity like this. the orgRrn is my tencent identifier.


/**

  • 所有的POJO基类

  • Created by guoxunbo on 2017/9/7.
    */
    @MappedSuperclass
    @Accessors(chain = true)
    @NoArgsConstructor
    @ToString
    //@Where(clause=NBBase.SQL_AVAILABLE_OBJ_CONDITION) 当前的@where无效。无法应用到子类。需要每个类都定义。计划在hibernate6.X上实现
    //@FilterDef(name = "multi-tenant", parameters = @ParamDef(name = "orgRrn", type = "long"))
    public class NBBase implements Serializable, Cloneable {

private static final long serialVersionUID = -4455314847475119658L;

public static final String AVAILABLE_OBJ_CONDITION = " activeFlag = 'Y'";
public static final String SQL_AVAILABLE_OBJ_CONDITION = " ACTIVE_FLAG = 'Y'";

public static final String ORG_CONDITION = " (orgRrn = :orgRrn OR orgRrn = 0)";

// public static final String SQL_BASE_CONDITION = " ACTIVE_FLAG = 'Y' AND (ORG_RRN = :orgRrn OR ORG_RRN = 0) ";

public static final String LANGUAGE_CHINESE = "Chinese";
public static final String LANGUAGE_ENGLISH = "English";

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="OBJECT_RRN")
@Setter
@Getter
protected Long objectRrn;

@Column(name="ORG_RRN")
@Getter
protected Long orgRrn = 0L;

@Column(name="ACTIVE_FLAG")
@Setter
@Getter
protected String activeFlag = StringUtils.YES;

public Boolean getActiveFlag() {
return StringUtils.YES.equalsIgnoreCase(activeFlag);
}

public void setActiveFlag(Boolean activeFlag) {
this.activeFlag = activeFlag ? StringUtils.YES : StringUtils.NO;
}
}
Thank you

Environment

jdk1.8.springboot 2.0.1.

Assignee

Unassigned

Reporter

XunBo Guo

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure