Java Code Examples for de.greenrobot.daogenerator.Entity#addDoubleProperty()

The following examples show how to use de.greenrobot.daogenerator.Entity#addDoubleProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyGreenDAOGenerator.java    From Maps with GNU General Public License v2.0 6 votes vote down vote up
private static void addCameraTable(Schema schema) {
    // 一个实体(类)就关联到数据库中的一张表,此处表名为「Note」(既类名)
    Entity camera = schema.addEntity("BJCamera");
    // 你也可以重新给表命名
    // note.setTableName("NODE");

    // greenDAO 会自动根据实体类的属性值来创建表字段,并赋予默认值
    // 接下来你便可以设置表中的字段:
    // 与在 Java 中使用驼峰命名法不同,默认数据库中的命名是使用大写和下划线来分割单词的。
    // For example, a property called “creationDate” will become a database column “CREATION_DATE”.
    camera.addIdProperty().autoincrement();
    camera.addStringProperty("name").notNull();
    camera.addStringProperty("address");
    camera.addDoubleProperty("latitude");
    camera.addDoubleProperty("longtitude");
    camera.addStringProperty("direction");
}
 
Example 2
Source File: Generator.java    From android-orm-benchmark with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    Schema schema = new Schema(DB_VERSION, PACKAGE);

    Entity user = schema.addEntity(USER_ENTITY);
    Property userPk = addCommonColumns(user);

    Entity message = schema.addEntity(MESSAGE_ENTITY);
    message.addIdProperty().autoincrement();
    message.addStringProperty(CONTENT);
    message.addLongProperty(CLIENT_ID);
    message.addIntProperty(CREATED_AT);
    message.addDoubleProperty(SORTED_BY);
    message.addLongProperty(COMMAND_ID).index();
    message.addLongProperty(SENDER_ID).notNull();
    message.addLongProperty(CHANNEL_ID).notNull();

    // One-to-many relationship
    message.addToMany(user, userPk, READERS);

    try {
        new DaoGenerator().generateAll(schema, "../ORM-Benchmark/src/");
    } catch (Exception e) {
        e.printStackTrace();
    }
}