public class CayenneConverter
extends java.lang.Object
CayenneModeler (which comes with Cayenne) includes a tool to convert EOModels to Cayenne models: create a new project and then choose Tools -> "Import EOModel".
I suggest trying that first. In my experience it didn't work well because the prototypes in ERPrototypes were not resolved.
This framework will allow you to convert an EOModel to a Cayenne model.
To use it just add the framework to your build path and then add this line to you application's constructor (replace MyModel with the name of your model):
new er.cayenne.CayenneConverter().run(EOModelGroup.defaultGroup().modelNamed("MyModel"));
Run your WO app.
This will create a Cayenne DataMap file (called MyModel.map.xml) in the root of your Sources folder.
To use it you will need to run CayenneModeler and create a new project.
Then give a name to the DataDomain (top-level) node that is created in the new project
Then choose File -> Import DataMap and select the .map.xml file that was generated.
The converter does not copy the connection dictionary from your model - you will need to re-enter that information by creating a DataNode using CayenneModeler.
The converter attempts to convert qualifiers for any fetch specifications you've defined in your model, but this should be considered just a best attempt, not guaranteed to be correct.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
JAVA_BIGDECIMAL |
static java.lang.String |
JAVA_BLOB |
static java.lang.String |
JAVA_BOOLEAN |
static java.lang.String |
JAVA_BYTE |
static java.lang.String |
JAVA_BYTES |
static java.lang.String |
JAVA_DOUBLE |
static java.lang.String |
JAVA_FLOAT |
static java.lang.String |
JAVA_INTEGER |
static java.lang.String |
JAVA_LONG |
static java.lang.String |
JAVA_SHORT |
static java.lang.String |
JAVA_SQLDATE |
static java.lang.String |
JAVA_STRING |
static java.lang.String |
JAVA_TIME |
static java.lang.String |
JAVA_TIMESTAMP |
static java.lang.String |
JAVA_UTILDATE |
static int |
NOT_DEFINED |
| Constructor and Description |
|---|
CayenneConverter() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getJavaClassName(EOAttribute attr) |
static int |
getSqlTypeByJava(java.lang.Class<?> javaClass)
Guesses a default JDBC type for the Java class.
|
static int |
getSqlTypeByJava(java.lang.String className)
Returns default java.sql.Types type by the Java type name.
|
static void |
main(java.lang.String[] args) |
void |
run(EOModel model)
Converts an EOModel to a Cayenne model / project.
|
public static final int NOT_DEFINED
public static final java.lang.String JAVA_LONG
public static final java.lang.String JAVA_BYTES
public static final java.lang.String JAVA_BOOLEAN
public static final java.lang.String JAVA_STRING
public static final java.lang.String JAVA_SQLDATE
public static final java.lang.String JAVA_UTILDATE
public static final java.lang.String JAVA_BIGDECIMAL
public static final java.lang.String JAVA_DOUBLE
public static final java.lang.String JAVA_FLOAT
public static final java.lang.String JAVA_INTEGER
public static final java.lang.String JAVA_SHORT
public static final java.lang.String JAVA_BYTE
public static final java.lang.String JAVA_TIME
public static final java.lang.String JAVA_TIMESTAMP
public static final java.lang.String JAVA_BLOB
public static void main(java.lang.String[] args)
public void run(EOModel model)
model - public java.lang.String getJavaClassName(EOAttribute attr)
public static int getSqlTypeByJava(java.lang.String className)
className - Fully qualified Java Class name.public static int getSqlTypeByJava(java.lang.Class<?> javaClass)
Copyright © 2002 – 2022 Project Wonder.