小编Bre*_*out的帖子

greenDAO生成器给出了没有意义的控制台错误

我对Android开发很新,我从来没有使用过greenDAO.但是在花了很多时间研究我的生成器类(我为我的实体建模)之后,我终于能够生成类似于GitHub上给出的示例的东西.

import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Property;
import de.greenrobot.daogenerator.Schema;
import de.greenrobot.daogenerator.ToMany;


public class simbalDAOgen {

public static void main(String[] args) throws Exception {
    Schema schema = new Schema(1, "com.bkp.simbal"); //Schema(Int version, String package name)
    addCBTrans(schema); //Add the entities to the schema
    new DaoGenerator().generateAll(schema, "../Simbal/src-gen", "../Simbal/src-test"); //Generate DAO files
}

private static void addCBTrans(Schema schema){
    Entity checkbook = schema.addEntity("Checkbook");
    checkbook.addIdProperty();
    checkbook.addStringProperty("name").notNull();
    checkbook.addDateProperty("dateModified");
    checkbook.addStringProperty("balance"); // Use a string property because BigDecimal type should be used for currency

    Entity transaction = schema.addEntity("Transaction");
    transaction.setTableName("TRANS"); …
Run Code Online (Sandbox Code Playgroud)

android greendao

5
推荐指数
1
解决办法
1834
查看次数

标签 统计

android ×1

greendao ×1