Most Android app development siege Lions have heard and worked effectively on Greendao, making it stand out among the many ORM tools.
Recently there is a project for the efficiency of SQLite, so it is quite, but in the middle encountered two problems title said
1. there is no corresponding API in the Greendao Generator project to set the default value, for example:
Entity.addintproperty ("Test"). Defvalue ("7");
2.greenDAO Generator the Java entity class and the DAO class used in the reference data type, such as: int->integer,long->long and so on, with this there is a problem, the caller plugs into the Integer, That is the risk of being null.
Check the information, Google, found Greendao disdain to achieve two functions, no way, wasted a long time to modify the source code, hit a jar package of their own projects with, share
The main changes in the Daogenerator project in the PROPERTY.JAVA,ENTITY.FTL,DAO.FTL these three files.
Once modified, you can use this:
//Test Private Static voidaddnote (schema Schema) {Entity Note= Schema.addentity ("Note"); Note.addidproperty (); Note.addstringproperty ("Text"). Notnull (). Defvalue ("\" y\ ""); Note.addstringproperty ("Comment"); Note.addstringproperty ("Test"); Note.addintproperty ("Test3"). Primjavatype (). Defvalue ("7"); Note.addintproperty ("Test4"); Note.adddateproperty ("Date"); }
Hit the jar, not uploaded, who have to leave the mailbox, I passed him.
Fixed an issue where Android Greendao has no default value and no original data type