Frage

Is it possible in Greendao to create a non-increment Primary Key.
So that i can specify the value each time i insert data.
Schema is :

     private static void addTargetNew(Schema schema){
         Entity target = schema.addEntity("Target");
         target.addStringProperty("TARGET_ID").unique();
     }

Delete Query :

    List<Target> tList = tDao.queryBuilder().where(Properties.TARGET_ID.eq(id)).list();
    if(tList != null){
        Target t = tList.get(0);
        tDao.delete(t);
    }

Where datatype of id is String.

Also before, downvoting, reporting, what ever the hell problem you might be having regarding this question PLEASE specify the reason and give me a chance for explaination.

War es hilfreich?

Lösung

No. The documentation says:

… entities must have a long or Long property as their primary key

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top