Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any Java ORM for dynamically created database tables?

Tags:

java

orm

We are thinking about switching from our custom made code to an ORM, in order to simplify our code base and move to a possibly more robust code. Currently we have a few "system" tables and a variable number of "custom" tables. Those custom tables are different for each installation: a customer may have tables about invoices, anther may have tables about insurance policies, and so on. These custom tables may be added any time and should be immediately available to the users. We wrote a bunch of java classes following the DBO schema: a class for each system table, plus one generic class for the custom tables. And, we have a generic java object that instantiate the custom records; this class have generic methods like Object getProperty(String name).

We had a look at a few ORMs, but we could not find any that will simplify the use of such custom tables.

Is there anyone with similar experience? Thanks.

like image 368
eppesuig Avatar asked Dec 23 '12 10:12

eppesuig


People also ask

How to make dynamic table in Java?

Java - Build a Dynamic Table. This example opens an existing report and adds a data source, data set and a table. The table columns are dynamically created based on an ArrayList that is passed in. The columns must exist in the query that is passed in.

Can tables be dynamically?

To create a dynamic table in Excel, we have two different methods: making a table of the data from the table section while another using the offset function. The reports and pivot tables also change as the data in the dynamic table changes in dynamic tables.


1 Answers

Maybe it is a task for a query mapper framework better than an ORM.

For example, using MyBatis you can dynamically map even the table name (See Setting the FROM clause via parameter in MyBatis)

<select id="getLookupRows" parameterType="map" resultMap="lookupMap">
   select id, name, active, valid
   from ${table}
</select>
like image 93
fglez Avatar answered Oct 06 '22 08:10

fglez