public class CayenneConverter extends Object
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"));
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 String |
JAVA_BIGDECIMAL |
static String |
JAVA_BLOB |
static String |
JAVA_BOOLEAN |
static String |
JAVA_BYTE |
static String |
JAVA_BYTES |
static String |
JAVA_DOUBLE |
static String |
JAVA_FLOAT |
static String |
JAVA_INTEGER |
static String |
JAVA_LONG |
static String |
JAVA_SHORT |
static String |
JAVA_SQLDATE |
static String |
JAVA_STRING |
static String |
JAVA_TIME |
static String |
JAVA_TIMESTAMP |
static String |
JAVA_UTILDATE |
static int |
NOT_DEFINED |
Constructor and Description |
---|
CayenneConverter() |
Modifier and Type | Method and Description |
---|---|
String |
getJavaClassName(EOAttribute attr) |
static int |
getSqlTypeByJava(Class<?> javaClass)
Guesses a default JDBC type for the Java class.
|
static int |
getSqlTypeByJava(String className)
Returns default java.sql.Types type by the Java type name.
|
static void |
main(String[] args) |
void |
run(EOModel model)
Converts an EOModel to a Cayenne model / project.
|
public static final int NOT_DEFINED
public static final String JAVA_LONG
public static final String JAVA_BYTES
public static final String JAVA_BOOLEAN
public static final String JAVA_STRING
public static final String JAVA_SQLDATE
public static final String JAVA_UTILDATE
public static final String JAVA_BIGDECIMAL
public static final String JAVA_DOUBLE
public static final String JAVA_FLOAT
public static final String JAVA_INTEGER
public static final String JAVA_SHORT
public static final String JAVA_BYTE
public static final String JAVA_TIME
public static final String JAVA_TIMESTAMP
public static final String JAVA_BLOB
public static void main(String[] args)
public void run(EOModel model)
model
- public String getJavaClassName(EOAttribute attr)
public static int getSqlTypeByJava(String className)
className
- Fully qualified Java Class name.public static int getSqlTypeByJava(Class<?> javaClass)
Copyright © 2002 – 2024 Project Wonder.