|
Project Wonder 5.0 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objecter.cayenne.CayenneConverter
public class CayenneConverter
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.
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
CayenneConverter()
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
| Constructor Detail |
|---|
public CayenneConverter()
| Method Detail |
|---|
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)
|
Last updated: Wed, Feb 22, 2012 07:00 AM EST | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||