转: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. Ubuntu 下用命令行快速打开html,mp3等文件

    想用命令行打开网页文件,实现方法如下: 1.Ctrl+Alt+T可以打开shell,F11可以全屏显示,输入以下命令即可打开js17.html,并且指定浏览器,比如指定chrome, google-c ...

  2. NSOperation, NSOperationQueue 原理探析

    通过GNUstep的Foundation来尝试探索下NSOperation,NSOperationQueue 示例程序 写一个简单的程序 - (void)viewDidLoad { [super vi ...

  3. RFID-RC522 与Arduino的连接

    一.前几天在某宝上刚买了个RFID-RC522  ,目标是复制我的门禁卡(看样子没多大希望了).二.各种百度各种谷歌都没找到与Arduino的连接方式. so,分享下我的连接方式,与大家共同进步... ...

  4. Java 图片矢量压缩

    直接贴出工具类源码 package com.snow.web.util.publics; import java.awt.Image; import java.awt.image.BufferedIm ...

  5. 【Oracle】Oracle中复合数据类型

    1,常见的操作数据库的技术有那些 jdbc     使用java 访问数据库的技术    PLSQL  (procedure  过程化sql) 在数据库内部操作数据的技术    proc/c++    ...

  6. Snip for Mac(桌面截图工具)安装

    1.软件简介    Snip 一款用于桌面截图的工具. 2.资源列表 链接 提取密码 系统要求 软件语言 Snip for Mac v2.0 (5771) fgab macOS 10.6.8 及以上 ...

  7. 关于Android NDK中调用第三方的动态库

    因为最近在整合Android 上RTSP播放器的网络库,因需要调用自己编译的网络库,调用一直出现问题,开始时是直接在Android.mk 中加入LOCAL_SHARED_LIBRARIES := li ...

  8. CUDA 中的计时方法

    问题描述:一般利用CUDA进行加速处理时,都需要测试CUDA程序的运行时间,来对比得到的加速效果. 解决方法: 1).GPU端计时,即设备端计时. 2).CPU端计时,即主机端计时. 设备端计时有两种 ...

  9. JavaScript 如何从引用类型(Array 、 Object)创建一个新的对象

    数组的增删改 1.新增一项可以使用concat方法,它不会对原有数组进行改动,而是创建一个新数组 let a = [0, 1, 2] let b = a.concat([3]) console.log ...

  10. python标准库介绍——30 code 模块详解

    ==code 模块== ``code`` 模块提供了一些用于模拟标准交互解释器行为的函数. ``compile_command`` 与内建 ``compile`` 函数行为相似, 但它会通过测试来保证 ...