I am currently working on a single table with more than one million rows.
The thing is, I'm currently thinking in a way to split it regarding an external parameter. This will leave me with 5 smaller tables, but with the same columns. Therefore, is there a way to select one of the 5 tables without copy/pasting my previous table 5 times ? I work with jsonRPC.
My controller looks like this :
List<ObuDataDto> getOBUCustAnalytics(@JsonRpcParam(value = "obuCust") String obucust,
@JsonRpcParam(value = "dateFrom") Double dateFrom,
@JsonRpcParam(value = "dateTo") Double dateTo,
@JsonRpcParam(value = "statisticsType") String[] statisticsType,
@JsonRpcParam(value = "productId") Integer productId,
@JsonRpcParam(value = "periodicity") String periodicity);
Depending on what's inside periodicity, I want to use a certain table. For now, my "too big" table looks like this :
@Table(name = "SAMPLE_DATA")
public class ObuDataDao {
@Column(name = "OBU_ID")
private String obuId;
@Column(name = "CUSTOMER_ID")
private String customerId;
@Column(name = "MONTH")
private Integer month;
@Column(name = "YEAR")
private Integer year;
@Column(name = "AMOUNT", precision = 16, scale = 2)
private Double amount;
@Column(name = "DISTANCE")
private Integer distance;
@Column(name = "REGION")
private Integer region;
@Column(name = "BILLED")
private Boolean billed;
@Id
@Column(name = "ID")
private Integer id;
}
I could make 5 different versions of this class (all columns would be the same) and load the correct DAO regarding the periodicity value, but I think there is a more elegant way to do it (using @SecondaryTable maybe ?) But I don't find anything about it