Introduction
I am working on a project and I confronted a weird use case that maybe ActiveJDBC is not meant for, I pledge for patience because many things in this project are not in my control:
I have 10 to 15 small/medium databases (~30 tables each, 40000 records max) and most of them share a "core" schema of 15 Tables, but at the same time they have some specific Tables unique for each database, they are all maintained by legacy systems which I don't have access to.
Goal
We(me and some conrades) will need to centralize the data in a kind of "convolunted data warehouse". Unfortunately for higher reasons, I can not use any technologies other than ActiveJDBC and everything other than that needs to be write by us (I know that this could be handled better with MongoDB and/or Liquibase)
We already handled the connection between the Databases, and the project itself is going well for most part. The part of the program that handles the core schema that all the databases share is already "working", but We are having trouble with their unique Tables.
I get all table names from the databases from a query that is made at runtime (not my choice either). We need to keep the number of classes at minimum preferably
Finally my question
Can I create a Generic/Dynamic Model or something similar, that can hold Data from a query at runtime? something like:
Model a = Base.findall("select * from ?", TableName)
or
Model a = Model.fromTable(Tablename)
I know it is weird to use a Model that way, but that would simplify our lives so much if we could get Table Data that way.
We will use this kind of Model mostly to get "raw" data from the Tables and satisfy interfaces, so no need to worry about each table relationship right now.
Thanks in Advance
@Edit: Thank you Igor for this awesome tool!
We kinda did it(almost)! Thank you. We were using a similar approach for the "core schema", but you kinda gave us some light.
As I commented:
We need to use the results of Base.findall() like it were a Model, would it be possible?