I am using Active JDBC. I have a use case where I wanted to read from table_date
on any given date where the structure/model of the table will be same for all the tables of this type. eg: registrations_29_10_2015
, registrations_10_11_2015
, etc.. where all the tables that start with registrations will have the same model/structure. How should I dynamically bind the table name with the model? I mean on 29th of Oct I want to use registrations_29_10_2015
and 10th of Nov I want to use registrations_10_11_2015
. Also: Is it possible to create a table at the start of the next day using active jdbc? And FYI, this is basically for sharding the tables and drop the old tables.
technically speaking the framework was designed to detect table names according to conventions. However, that information is stored in a class called MetaModel: http://javalite.github.io/activejdbc/org/javalite/activejdbc/MetaModel.html#getTableName()
Each model is backed by a MetaModel. While you cannot just set the table name to the MetaModel, it is not that hard to add this feature. Please, open an issue on the project repo for consideration.
Edit: we released the sharding in ActiveJDBC a few days ago: http://javalite.io/sharding. It does exactly what you need, enjoy.