The greenDAO generator gives a console error that doesn't make sense

I am new to Android development in general, and I have not even used greenDAO. But, having spent a lot of time on my generator class (where I model my entities), I was finally able to create something similar to the example provided in 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"); // "TRANSACTION" is a reserved SQLite keyword
    transaction.addIdProperty();
    transaction.addStringProperty("name");
    transaction.addStringProperty("category");
    Property transDate = transaction.addDateProperty("date").getProperty();
    transaction.addStringProperty("amount"); // Again use string for BigDecimal type
    transaction.addStringProperty("notes");
    Property cbName = transaction.addStringProperty("cb").notNull().getProperty(); //What checkbook the transaction is in

    ToMany cbToTrans = checkbook.addToMany(transaction, cbName); //Actually ties the transactions to their correct checkbooks
    cbToTrans.setName("Transactions");
    cbToTrans.orderAsc(transDate);
}       
}

Then I ran the code as a java application to create my DAO files, as described in the greenDAO documentation. The files were successfully generated, however I got this line in the console in Eclipse:

Warning to-one property type does not match target key type: ToMany 'Transactions' from Checkbook to Transaction

, , . , " ", " ", . ( , .)

? , , -, !

+5
2

, greenDAO, . , addToMany() , Long , String. :

Property cbName = transaction.addStringProperty("cb").notNull().getProperty();

ToMany cbToTrans = checkbook.addToMany(transaction, cbName);

:

Property checkbookId = transaction.addLongProperty("checkbookId").notNull().getProperty();

ToMany cbToTrans = checkbook.addToMany(transaction, checkbookId);

. , , .

+7

, GreenDao Long

0

All Articles