Re: Java code generation from sql
- From: Dyreatnews@xxxxxxx
- Date: Thu, 08 Jun 2006 19:47:56 +0200
"Oliver Wong" <owong@xxxxxxxxxxxxxx> writes:
"Remi" <remi.roques@xxxxxxxxx> wrote in message
news:1149751500.241078.171210@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I am working on a simulator in Java. All the parameters of the
simulator are stored in a SQL databse (a priori). The idea would be to
generate java code (.java files) from this databse in order to compile
the simulator afterwards and have an application running without the
database (faster I think).
Do you have any idea about a tool doing that or how the create a java
code generation from a database (sql or not) ?
Have you considered using a bunch of println(); statements to emit
a .java file? E.g.
fileOut.println("public class Test() { System.out.println(\"Hello
World!\"); }");
It's the most direct and simplest solution. If it's too simplistic
for you, you might want to investigate JET templates from Eclipse.
Maybe I don't understand what the OP is asking, but why can't you create
a simulation "harness" that that uses interfaces for the parts of the
simulation that depend on parameters from your database?
You can then provide various implementations for these interfaces to
control your simulation.
You can still keep the config paramters in a database. Just query the
parameters from the database when you start your simulation and feed
the parameters to factories that return the correct implementations
for this simulation. If need be, you could store the name of the
implementation in the database and use reflection to instantiate it.
When this step has completed your simulation would run without any
interaction with the database.
I think this would be both easier and faster than fetching actual java
source code out of a db and try to assemble it into something that you
can compile...
--
dt
.
- References:
- Java code generation from sql
- From: Remi
- Re: Java code generation from sql
- From: Oliver Wong
- Java code generation from sql
- Prev by Date: Re: Java code generation from sql
- Next by Date: java.sql.SQLException [Microsoft][ODBC Driver Manag
- Previous by thread: Re: Java code generation from sql
- Next by thread: java.sql.SQLException [Microsoft][ODBC Driver Manag
- Index(es):
Relevant Pages
|