转:http://stackoverflow.com/questions/22070281/greendao-support-for-unique-constraint-on-multiple-columns

Does GreenDao supports unique constraint on multiple columns? Equivalent of the following:

create table projects (
_id integer primary key autoincrement,
project_type text,
name text,
unique (project_type, name)
);

Yes, it supports.

Create an index with all the properties and make it unique.

Index indexUnique = new Index();
indexUnique.addProperty(project_type);
indexUnique.addProperty(name);
indexUnique.makeUnique();
projectsEntity.addIndex(indexUnique);

Unique constraint on single String column with GreenDao的更多相关文章

  1. Unique constraint on single String column with GreenDao2

    转:http://software.techassistbox.com/unique-constraint-on-single-string-column-with-greendao_384521.h ...

  2. SQL UNIQUE Constraint

    SQL UNIQUE Constraint The UNIQUE constraint uniquely identifies each record in a database table. The ...

  3. ORA-00001: unique constraint (string.string) violated 违反唯一约束条件(.)

    ORA-00001: unique constraint (string.string) violated   ORA-00001: 违反唯一约束条件(.) Cause: An UPDATE or I ...

  4. Oracle 唯一 约束(unique constraint) 与 索引(index) 关系说明

    一. 官网对Unique Constraints说明 http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/datainte.h ...

  5. Sqlite - constraint failed[0x1555]: UNIQUE constraint failed

    执行插入操作时,出现异常constraint failed[0x1555]: UNIQUE constraint failed 意思是:sqlite 唯一约束失败 定位于某个表字段上,该字段是表的主键 ...

  6. ORA-00001: unique constraint (...) violated解决方案

    ORA-00001: unique constraint (...) violated 的解决方案 今天往Oracle数据库里插入数据一条记录的时候,报错了, 控制台抛出异常:违反唯一性约定, 我以为 ...

  7. sqlite3, IntegrityError: UNIQUE constraint failed when inserting a value

    sqlite报错: sqlite3.IntegrityError: UNIQUE constraint failed: IMAGESTATUE.ID 解决方案: Change INSERT to IN ...

  8. ORA-00001: unique constraint (...) violated并不一定是数据冲突

    原文链接:http://blog.163.com/jet_it_life/blog/static/205097083201301410303931/ 收到一位测试人员RAISE的JIRA,说在某张表上 ...

  9. Oracle之唯一性约束(UNIQUE Constraint)使用方法具体解释

    Oracle | PL/SQL唯一索引(Unique Constraint)使用方法 1 目标 用演示样例演示怎样创建.删除.禁用和使用唯一性约束. 2 什么是唯一性约束? 唯一性约束指表中一个字段或 ...

随机推荐

  1. JavaScript Window Navigator 浏览器本身的信息

    window.navigator 对象包含有关访问者浏览器的信息. Window Navigator window.navigator 对象在编写时可不使用 window 这个前缀. Navigato ...

  2. apache安装mod_ssl.so 出现 undefined symbol: ssl_cmd_SSLPassPhraseDialog错误解决

    很久很久以前,安装Apache的时候,根本没想过将来的某一天会使用到ssl,所以也就没有安装那个模块,结果今天需要用到的时候,却无从下手了. 由于在安装Apache的时候,mod_ssl.so这个文件 ...

  3. 使用Anemometer分析MySQL慢查询记录

    数据库管理员一般是用percona的toolkit工具来分析MySQL慢查询记录,但是不够直观. 下面介绍一款比较直观的工具来统计分析MySQL慢查询记录anemometer. 在使用之前需要安装pe ...

  4. Socket编程:之TCP案例

    转载请加上博文引用:http://i.cnblogs.com/EditPosts.aspx?postid=5733248&update=1 服务端: #include <stdio.h& ...

  5. Http网络协议

    目录结构: contents structure [-] 什么是HTTP协议 Http协议的发展历史 Http的报文结构 客户端请求 服务端响应消息 Content-Type application/ ...

  6. golang学习笔记---函数、方法和接口

    函数:对应操作序列,是程序的基本组成元素. 函数有具名和匿名之分:具名函数一般对应于包级的函数,是匿名函数的一种特例,当匿名函数引用了外部作用域中的变量时就成了闭包函数,闭包函数是函数式编程语言的核心 ...

  7. ldd 的一个安全问题

    我们知道“ldd”这个命令主要是被程序员或是管理员用来查看可执行文件所依赖的动态链接库的.是的,这就是这个命令的用处.可是,这个命令比你想像的要危险得多,也许很多黑客通过ldd的安全问题来攻击你的服务 ...

  8. Fragment使用具体解释

    fragment是Google在3.0版本号中推出的新功能,如今已经增加到V4包中,假设要使用V4兼容包中的Fragment须要将Activity换成FragmentActivity,调用的getSu ...

  9. 迁移TFS,批量将文档导入SharePoint 2013 文档库

    一.需求分析 公司需要将存在于旧系统(TFS)所有的文档迁移至新系统(SharePoint 2013).现已经将50G以上的文档拷贝到SharePoint 2013 Server上.这些文档是一些不规 ...

  10. PhotoShop CS6实现照片背景虚化效果

    在摄影实践中,虚化背景是突出主体的常用手段.但是由于消费级DC镜头的实际焦距都很短,因此实现浅景深而虚化背景的难度较大.如果我们希望用消费级DC也能达到虚化背景突出主体的效果,那么,Photoshop ...