Alexander B
Alexander B

Reputation: 3500

Exception when generating greenDao with String Primary Key

On compilation of greendao classes, I have an exception:

Exception in thread "main" java.lang.RuntimeException: Source properties do not match target properties

      private static void addMainSchema(Schema schema) {


        Entity user = schema.addEntity("User");
        user.addIdProperty();
        user.addStringProperty("userName").unique().primaryKey();
        user.addStringProperty("firstname");
        user.addStringProperty("lastname");
        user.addStringProperty("phone");
        user.addStringProperty("secretKey");
        user.addStringProperty("wifiPassword");
        user.addStringProperty("stepLength");
        user.addStringProperty("password");
}

Upvotes: 0

Views: 305

Answers (1)

Alexander B
Alexander B

Reputation: 3500

Case: It is appear when IdProperty has been set before primary key. Fix: removing IdProperty.

 //    user.addIdProperty();

 user.addStringProperty("userName").unique().primaryKey();

Upvotes: 2

Related Questions