Room Persistance Library Query COLLATE LOCALIZED not working

Viewed 2719

I'm using the new Room Persistance Library released at this years Google I/O and it's working great so far, but somehow it's not possible to order the results with UNICODE or LOCALIZED. The only thing working is NOCASE which is useless in my case.

Is there any way to achieve this functionality yet?

@Dao
public interface ContactDao { 

    @Query("SELECT * FROM contact ORDER BY lastName COLLATE LOCALIZED")
    Flowable<List<Contact>> getAll();
}

If I build the Query like above i get an error:

Error:(21, 29) error: There is a problem with the query: [SQLITE_ERROR] 
SQL error or missing database (no such collation sequence: LOCALIZED)
3 Answers

you have to use these version of room

compile "android.arch.persistence.room:runtime:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"

after updating your room gradle line

you can use this feature

@ColumnInfo(collate = ColumnInfo.NOCASE)

Related