|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.knowledgeplaza.util.jpa.JpaReverseEngineer
public class JpaReverseEngineer
This class reverse engineers a business model (BM) from a RDBMS schema via a JDBC connection. The generated BM is not thread safe, this means only one thread-per-entity-manager is allowed to access the BM. If you have code (like swing applications) that spawn threads, make sure only one is accessing the BM at the same time using a lock or other synchronization mechanism. http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/locks/Lock.html Since it practically is impossible to write thread safe BM's (like it is to write threads safe GUI libraries, like Swing), this is left to the developer. Please be aware that when coding against another threading environment (e.g. Swing) this may result in some "interesting" logic, especially when using a binding library. For example: suppose a separate thread was spawned to do some heavy lifting in the BM. This thread will do some work, create or alter collections, and as a result some Swing components have to be updated. The Swing components most likely will directly use the BM, e.g. a List that will shown, say, Persons using a custom Renderer, or a Textfield that displays a name or total. These swing components most likely are bound to the BM using a binding library (e.g. JGoodies). Ok, suppose the worker sets the name of a person, the binding library will then automatically update the TextField. But unless the binding library hands it over to the Swing Thread, this will be done outside the Swing thread! To be continued...
| Field Summary | |
|---|---|
static java.lang.String |
ATLOADTIMEPOSTFIX
|
| Constructor Summary | |
|---|---|
JpaReverseEngineer()
|
|
| Method Summary | |
|---|---|
protected java.lang.String |
convertDbIdentifierToJavaNotation(java.lang.String id,
java.lang.String type,
boolean stripIdPostfix)
Converts database id to java id, allowing for id overriding, and incorporates stripping |
static java.lang.String |
convertDbIdentifierToJavaNotationPure(java.lang.String id)
Converts a database id to java id without any tuning The resulting Java camelcase ID will start with a capital |
protected java.lang.String |
convertDbIdentifierToJavaProperty(java.lang.String id,
java.lang.String type)
Without stripping "nr" |
protected java.lang.String |
convertDbIdentifierToJavaPropertyStripIdPostfix(java.lang.String id,
java.lang.String type)
With stripping "nr" |
void |
generateClass(java.io.File javaFile,
java.lang.String packageName,
java.lang.String tableName,
java.lang.String className,
boolean isWritable)
|
void |
generateClass(java.lang.String baseDirName,
java.lang.String packageName,
java.lang.String tableName,
boolean isWritable)
|
void |
generatePKClass(java.io.File lJavaFile,
java.lang.String lPackageName,
java.lang.String lTableName,
java.lang.String lClassName,
java.util.List lPrimaryKeys,
java.util.Map<java.lang.String,java.lang.String> primaryKeyColumnToJava)
|
protected java.lang.String |
getWhereIAm()
|
void |
go()
|
static void |
main(java.lang.String[] args)
|
protected java.lang.String |
pullThroughConfigurationPropertiesRenameRules(java.lang.String id,
java.lang.String type)
See if there are rename rules for this id |
protected void |
writeComparator(java.util.Map<java.lang.String,java.lang.String> properties,
java.lang.String packageName,
java.lang.String className,
java.io.Writer lWriter)
|
protected java.lang.String |
writeDefaultValue(java.lang.String lJavaType,
java.lang.String defaultValue)
|
protected void |
writeFindBy(java.util.Map<java.lang.String,java.lang.String> properties,
java.lang.String packageName,
java.lang.String className,
java.io.Writer lWriter,
java.util.List<java.lang.String> findByMethods)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.lang.String ATLOADTIMEPOSTFIX
| Constructor Detail |
|---|
public JpaReverseEngineer()
properties - | Method Detail |
|---|
public static void main(java.lang.String[] args)
args -
public void go()
throws java.sql.SQLException
java.sql.SQLException
public void generateClass(java.lang.String baseDirName,
java.lang.String packageName,
java.lang.String tableName,
boolean isWritable)
throws java.sql.SQLException
databaseMetaDataRs -
java.sql.SQLException
public void generateClass(java.io.File javaFile,
java.lang.String packageName,
java.lang.String tableName,
java.lang.String className,
boolean isWritable)
throws java.io.IOException,
java.sql.SQLException
databaseMetaDataRs -
java.io.IOException
java.sql.SQLException
public void generatePKClass(java.io.File lJavaFile,
java.lang.String lPackageName,
java.lang.String lTableName,
java.lang.String lClassName,
java.util.List lPrimaryKeys,
java.util.Map<java.lang.String,java.lang.String> primaryKeyColumnToJava)
throws java.io.IOException,
java.sql.SQLException
databaseMetaDataRs -
java.io.IOException
java.sql.SQLException
protected void writeFindBy(java.util.Map<java.lang.String,java.lang.String> properties,
java.lang.String packageName,
java.lang.String className,
java.io.Writer lWriter,
java.util.List<java.lang.String> findByMethods)
throws java.io.IOException
properties -
java.io.IOException
protected void writeComparator(java.util.Map<java.lang.String,java.lang.String> properties,
java.lang.String packageName,
java.lang.String className,
java.io.Writer lWriter)
throws java.io.IOException
properties - packageName - className - lWriter -
java.io.IOException
protected java.lang.String convertDbIdentifierToJavaPropertyStripIdPostfix(java.lang.String id,
java.lang.String type)
lId -
protected java.lang.String convertDbIdentifierToJavaProperty(java.lang.String id,
java.lang.String type)
lId -
protected java.lang.String convertDbIdentifierToJavaNotation(java.lang.String id,
java.lang.String type,
boolean stripIdPostfix)
lId -
public static java.lang.String convertDbIdentifierToJavaNotationPure(java.lang.String id)
id -
protected java.lang.String pullThroughConfigurationPropertiesRenameRules(java.lang.String id,
java.lang.String type)
lId -
protected java.lang.String writeDefaultValue(java.lang.String lJavaType,
java.lang.String defaultValue)
lColumnType -
protected java.lang.String getWhereIAm()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||