-
Notifications
You must be signed in to change notification settings - Fork 24
Tools
aadrian edited this page Nov 11, 2017
·
7 revisions
You can generate Entity Classes from DB schemas using com.miragesql.miragesql.tools.EntityGen
.
// setup
EntityGen gen = new EntityGen();
gen.setPackageName("com.mycorp.myapp.entity");
gen.setNameConverter(new DefaultNameConverter());
gen.setDialect(new StandardDialect());
// generate
String source = gen.getEntitySource(conn, "BOOK", null, null);
The generation tool is also available as Ant task.
<project name="Mirage EntityGen" basedir="." default="gen_entity">
<target name="gen_entity">
<path id="class.path">
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</path>
<taskdef name="entityGen"
classname="com.miragesql.miragesql.tools.EntityGenTask"
classpathref="class.path" />
<entityGen
driver="org.hsqldb.jdbc.JDBCDriver"
url="jdbc:hsqldb:mem:mirage_test"
user="sa"
password="" />
</target>
</project>