博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
GreenDao
阅读量:4693 次
发布时间:2019-06-09

本文共 1017 字,大约阅读时间需要 3 分钟。

public class GreenDaoUtil {
private static DaoSession daoSession = null; public static DaoSession getDaoSession(Context context) {
if (daoSession == null) {
daoSession = DaoMaster.newDevSession(context, "bw.db"); } // DaoSession daoSession = GreenDaoUtil.getDaoSession(this); // GreenDaoTableDao greenDaoTableDao = daoSession.getGreenDaoTableDao(); // 通过greenDaoTableDao来进行数据库的操作 return GreenDaoUtil.daoSession; } }
//项目build.gradle文件中添加 classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
//app gradle 中 放到 dependencies 的外边     greendao {
schemaVersion 3 //数据库版本号 daoPackage 'com.example.项目名.database' //设置时生成代码的目录 targetGenDir 'src/main/java' //设置DaoMaster、DaoSession、Dao目录 } //app 的build.gradle文件中添加
apply plugin: 'org.greenrobot.greendao'
//greenDao依赖 implementation 'org.greenrobot:greendao:3.2.2' implementation 'org.greenrobot:greendao-generator:3.2.2'

转载于:https://www.cnblogs.com/fybb/p/11577010.html

你可能感兴趣的文章
java 随机函数初试,输出一个32位的随机数
查看>>
六、雪花《苹果iOS实例编程入门教程》
查看>>
单页面应用(SPA)
查看>>
mahout 安装
查看>>
Application,Session和Cookie
查看>>
sql中的系统表sysobjects以及如何查看sql语句的执行时间
查看>>
Git的使用
查看>>
Redis Python开发指南
查看>>
4.如果给一个单位做相关的软件,你认为最重要的是需要得到谁的支持,为什么?...
查看>>
视图基本
查看>>
提高Java代码质量的Eclipse插件之Checkstyle的使用具体解释
查看>>
【莫比乌斯反演】——蒟蒻的理解
查看>>
ORM系列之二:EF(4) 约定、注释、Fluent API
查看>>
cnblogs latex公式
查看>>
js中的替换
查看>>
SKTextureAtlas类
查看>>
自己写的网页放在github里面
查看>>
关于Git的学习
查看>>
nginx proxy文件编写总结
查看>>
决策树应用
查看>>