Fixed
Status Update
Comments
be...@google.com <be...@google.com> #2
Also, it would be great to return Observable, cause Flowable has some overhead.
mm...@commonsware.com <mm...@commonsware.com> #3
We are going to add Single for queries (and Maybe) but for @insert, @Update and @Delete it is a bit more tricky because we would be reading those values when the computable runs, in which case developer may change them by mistake. We've not decided whether we want to take that risk or not. (We could copy but that would be additional hidden load, especially if the input is a long list).
#2, flowable can easily turn into an observable, would you like to escalate on why you think the overhead is a problem?
#2, flowable can easily turn into an observable, would you like to escalate on why you think the overhead is a problem?
yb...@google.com <yb...@google.com> #4
Cool for Single/Maybe for queries :)
For @insert, @Update and @Delete I personally would like to have the possibility to have Single/Maybe... because I will 100% of the time wrap the call into a Single to make it asynchronous and have the possibility to chain other actions with it. I understand that copying entries will take additional resources but in that case we'll have the possibility to not use the RX return type.
That my opinion ^^
Thanks !
For @insert, @Update and @Delete I personally would like to have the possibility to have Single/Maybe... because I will 100% of the time wrap the call into a Single to make it asynchronous and have the possibility to chain other actions with it. I understand that copying entries will take additional resources but in that case we'll have the possibility to not use the RX return type.
That my opinion ^^
Thanks !
mm...@commonsware.com <mm...@commonsware.com> #5
Shouldn't this be typed as a feature request?
yb...@google.com <yb...@google.com>
te...@gmail.com <te...@gmail.com> #6
ch...@gmail.com <ch...@gmail.com> #7
This issue is half year old and it's still not implemented. Without this the library is unusable.
jf...@gmail.com <jf...@gmail.com> #8
+1
mm...@commonsware.com <mm...@commonsware.com> #9
+1 Here as well. I would like Completable support.
ry...@gmail.com <ry...@gmail.com> #10
+1 i think Completable support is necessary
se...@google.com <se...@google.com>
ol...@gmail.com <ol...@gmail.com> #11
+1 for Completable support as well
rm...@gmail.com <rm...@gmail.com> #12
+1 for completable - just missed it on the fly while coding
to...@gmail.com <to...@gmail.com> #13
+1 for Completable support as well
ra...@gmail.com <ra...@gmail.com> #14
+1 for completable for @Delete @Update and @Insert
fh...@gmail.com <fh...@gmail.com> #15
+1 for Completable support as well
yb...@google.com <yb...@google.com> #16
Please Give a star instead of adding new comments.
em...@gmail.com <em...@gmail.com> #17
This would be a nice improvement!
My initial response is to wrap the insert in a Completable when exposing the call to a consumer because of the time spent writing to the file system on the main thread. Guessing would probably desire the same API for delete.
Out of the box without LiveData/RxJava support for those types of calls it would violate strict rules and run into the guards of Room ensures that database is never accessed on the main thread.
My initial response is to wrap the insert in a Completable when exposing the call to a consumer because of the time spent writing to the file system on the main thread. Guessing would probably desire the same API for delete.
Out of the box without LiveData/RxJava support for those types of calls it would violate strict rules and run into the guards of Room ensures that database is never accessed on the main thread.
em...@gmail.com <em...@gmail.com> #18
It's really necessary thing and it's not implemented still(
yb...@google.com <yb...@google.com> #19
+1 Come on we need support for completable. its been more than an year :(
em...@gmail.com <em...@gmail.com> #20
we are targeting this for 2.1.
em...@gmail.com <em...@gmail.com> #21
+1 for completable for @Delete @Update and @Insert
yb...@google.com <yb...@google.com>
ab...@gmail.com <ab...@gmail.com> #22
+1 Come on guys!! ^_^
ap...@google.com <ap...@google.com> #23
Project: platform/frameworks/support
Branch: androidx-master-dev
commit c0c36b71b1e73eeaa49e5f29c2e3ee3923c811da
Author: Florina Muntenescu <florinam@google.com>
Date: Wed Aug 15 10:49:18 2018
Refactoring insert/update/delete to allow extensibility around the return type
Bug: 63317956
Test: tests updated
Change-Id: I5f8168fbd5cf08e64cb80c1835f4eebef6b4e018
M room/compiler/src/main/kotlin/androidx/room/processor/DeletionMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/InsertionMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/compiler/src/main/kotlin/androidx/room/processor/UpdateMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/DeleteOrUpdateMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InsertMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/DeleteOrUpdateMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InsertMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantDeleteOrUpdateMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateMethodAdapter.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertMethodAdapter.kt
M room/compiler/src/main/kotlin/androidx/room/vo/DeletionMethod.kt
M room/compiler/src/main/kotlin/androidx/room/vo/InsertionMethod.kt
M room/compiler/src/main/kotlin/androidx/room/vo/ShortcutMethod.kt
M room/compiler/src/main/kotlin/androidx/room/vo/UpdateMethod.kt
M room/compiler/src/main/kotlin/androidx/room/writer/DaoWriter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/DeletionMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/processor/InsertionMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/processor/UpdateMethodProcessorTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BooksDao.kt
https://android-review.googlesource.com/732628
https://goto.google.com/android-sha1/c0c36b71b1e73eeaa49e5f29c2e3ee3923c811da
Branch: androidx-master-dev
commit c0c36b71b1e73eeaa49e5f29c2e3ee3923c811da
Author: Florina Muntenescu <florinam@google.com>
Date: Wed Aug 15 10:49:18 2018
Refactoring insert/update/delete to allow extensibility around the return type
Bug: 63317956
Test: tests updated
Change-Id: I5f8168fbd5cf08e64cb80c1835f4eebef6b4e018
M room/compiler/src/main/kotlin/androidx/room/processor/DeletionMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/InsertionMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/compiler/src/main/kotlin/androidx/room/processor/UpdateMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/DeleteOrUpdateMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InsertMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/DeleteOrUpdateMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InsertMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantDeleteOrUpdateMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateMethodAdapter.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertMethodAdapter.kt
M room/compiler/src/main/kotlin/androidx/room/vo/DeletionMethod.kt
M room/compiler/src/main/kotlin/androidx/room/vo/InsertionMethod.kt
M room/compiler/src/main/kotlin/androidx/room/vo/ShortcutMethod.kt
M room/compiler/src/main/kotlin/androidx/room/vo/UpdateMethod.kt
M room/compiler/src/main/kotlin/androidx/room/writer/DaoWriter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/DeletionMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/processor/InsertionMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/processor/UpdateMethodProcessorTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BooksDao.kt
ap...@google.com <ap...@google.com> #24
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 524c841aa2bec6fa72768b1aeb40f6c6b6734907
Author: Florina Muntenescu <florinam@google.com>
Date: Mon Sep 03 16:37:48 2018
Adding RxJava support to insert
Bug: 63317956
Change-Id: Ic122774f591319dcd70d7f362af94adb0342184b
Test: InsertionMethodProcessorTest and TypeAdapterStoreTest updated
M room/compiler/src/main/kotlin/androidx/room/ext/javapoet_ext.kt
M room/compiler/src/main/kotlin/androidx/room/processor/InsertionMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/RxCallableInsertMethodBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InsertMethodBinderProvider.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertMethodBinderProvider.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertMethodAdapter.kt
A room/compiler/src/test/data/common/input/rxjava2/Completable.java
A room/compiler/src/test/data/common/input/rxjava2/Maybe.java
A room/compiler/src/test/data/common/input/rxjava2/Single.java
M room/compiler/src/test/kotlin/androidx/room/processor/InsertionMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/solver/TypeAdapterStoreTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/test_util.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BooksDao.kt
https://android-review.googlesource.com/745108
https://goto.google.com/android-sha1/524c841aa2bec6fa72768b1aeb40f6c6b6734907
Branch: androidx-master-dev
commit 524c841aa2bec6fa72768b1aeb40f6c6b6734907
Author: Florina Muntenescu <florinam@google.com>
Date: Mon Sep 03 16:37:48 2018
Adding RxJava support to insert
Bug: 63317956
Change-Id: Ic122774f591319dcd70d7f362af94adb0342184b
Test: InsertionMethodProcessorTest and TypeAdapterStoreTest updated
M room/compiler/src/main/kotlin/androidx/room/ext/javapoet_ext.kt
M room/compiler/src/main/kotlin/androidx/room/processor/InsertionMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/RxCallableInsertMethodBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InsertMethodBinderProvider.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertMethodBinderProvider.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertMethodAdapter.kt
A room/compiler/src/test/data/common/input/rxjava2/Completable.java
A room/compiler/src/test/data/common/input/rxjava2/Maybe.java
A room/compiler/src/test/data/common/input/rxjava2/Single.java
M room/compiler/src/test/kotlin/androidx/room/processor/InsertionMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/solver/TypeAdapterStoreTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/test_util.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BooksDao.kt
ap...@google.com <ap...@google.com> #25
Project: platform/frameworks/support
Branch: androidx-master-dev
commit ecce72935bbe7987a9c0c1639f4aa245153c717a
Author: Florina Muntenescu <florinam@google.com>
Date: Fri Sep 07 15:36:18 2018
Add RxJava support for Delete and Update methods in Room.
Support for update and delete returning Integer also added.
Now, update and delete support:
* void
* int
* Integer
* Completable
* Single<Integer>
* Maybe<Integer>
Refactored the DeleteOrUpdateMethodAdapter to hold the return type, like InsertMethodAdapter is.
Bug: 63317956
Test: DaoWriterTest, TypeAdapterStoreTest, kotlin integration tests
Change-Id: Ic8d3cff21b9e8179fed237a18421c13b3e59059b
M room/compiler/src/main/kotlin/androidx/room/processor/DeletionMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/UpdateMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/DeleteOrUpdateMethodBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/RxCallableDeleteOrUpdateMethodBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/DeleteOrUpdateMethodBinderProvider.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantDeleteOrUpdateMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateMethodBinderProvider.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateMethodAdapter.kt
M room/compiler/src/main/kotlin/androidx/room/vo/DeletionMethod.kt
M room/compiler/src/main/kotlin/androidx/room/vo/ShortcutMethod.kt
M room/compiler/src/main/kotlin/androidx/room/vo/UpdateMethod.kt
M room/compiler/src/main/kotlin/androidx/room/writer/DaoWriter.kt
M room/compiler/src/test/data/common/input/rxjava2/Completable.java
M room/compiler/src/test/data/common/input/rxjava2/Maybe.java
M room/compiler/src/test/data/common/input/rxjava2/Single.java
M room/compiler/src/test/data/daoWriter/input/DeletionDao.java
M room/compiler/src/test/data/daoWriter/input/UpdateDao.java
M room/compiler/src/test/data/daoWriter/output/DeletionDao.java
M room/compiler/src/test/data/daoWriter/output/UpdateDao.java
M room/compiler/src/test/kotlin/androidx/room/processor/ShortcutMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/solver/TypeAdapterStoreTest.kt
M room/compiler/src/test/kotlin/androidx/room/writer/DaoWriterTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BooksDao.kt
https://android-review.googlesource.com/750573
https://goto.google.com/android-sha1/ecce72935bbe7987a9c0c1639f4aa245153c717a
Branch: androidx-master-dev
commit ecce72935bbe7987a9c0c1639f4aa245153c717a
Author: Florina Muntenescu <florinam@google.com>
Date: Fri Sep 07 15:36:18 2018
Add RxJava support for Delete and Update methods in Room.
Support for update and delete returning Integer also added.
Now, update and delete support:
* void
* int
* Integer
* Completable
* Single<Integer>
* Maybe<Integer>
Refactored the DeleteOrUpdateMethodAdapter to hold the return type, like InsertMethodAdapter is.
Bug: 63317956
Test: DaoWriterTest, TypeAdapterStoreTest, kotlin integration tests
Change-Id: Ic8d3cff21b9e8179fed237a18421c13b3e59059b
M room/compiler/src/main/kotlin/androidx/room/processor/DeletionMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/processor/UpdateMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/DeleteOrUpdateMethodBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateMethodBinder.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/RxCallableDeleteOrUpdateMethodBinder.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/DeleteOrUpdateMethodBinderProvider.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantDeleteOrUpdateMethodBinderProvider.kt
A room/compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateMethodBinderProvider.kt
M room/compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateMethodAdapter.kt
M room/compiler/src/main/kotlin/androidx/room/vo/DeletionMethod.kt
M room/compiler/src/main/kotlin/androidx/room/vo/ShortcutMethod.kt
M room/compiler/src/main/kotlin/androidx/room/vo/UpdateMethod.kt
M room/compiler/src/main/kotlin/androidx/room/writer/DaoWriter.kt
M room/compiler/src/test/data/common/input/rxjava2/Completable.java
M room/compiler/src/test/data/common/input/rxjava2/Maybe.java
M room/compiler/src/test/data/common/input/rxjava2/Single.java
M room/compiler/src/test/data/daoWriter/input/DeletionDao.java
M room/compiler/src/test/data/daoWriter/input/UpdateDao.java
M room/compiler/src/test/data/daoWriter/output/DeletionDao.java
M room/compiler/src/test/data/daoWriter/output/UpdateDao.java
M room/compiler/src/test/kotlin/androidx/room/processor/ShortcutMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/solver/TypeAdapterStoreTest.kt
M room/compiler/src/test/kotlin/androidx/room/writer/DaoWriterTest.kt
M room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/dao/BooksDao.kt
ap...@google.com <ap...@google.com> #26
Support for Single, Maybe and Completable added for insert, update and delete. To be released in Room 2.1
yb...@google.com <yb...@google.com> #29
Yes, this is specific to AutoValue (we also support regular java immutables and kotlin) as this solves the problem w/o any extra code on the developer side.
Having an entity factory method seems reasonable too as a future improvement.
Having an entity factory method seems reasonable too as a future improvement.
ub...@gmail.com <ub...@gmail.com> #30
Would it be possible to support the AutoValue Builder pattern? Currently the only supported pattern appears to require a create() method.
da...@google.com <da...@google.com> #31
Your AutoValue class can have an @AutoValue.Builder along side with a create() method as shown here: https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/room/integration-tests/autovaluetestapp/src/androidTest/java/androidx/room/integration/autovaluetestapp/vo/Person.java . If you are asking for Room to solely support the Builder pattern without any create() method then please file a separate issue since that is not currently available.
Description
Version used: 1.0.0-alpha2
Devices/Android versions reproduced on: n/a
Immutability is gaining popularity. AutoValue is a popular way of implementing immutability in Java. However, Room seems field-centric, and with AutoValue, the fields are code-generated. For example, @PrimaryKey does not work when applied to a getter method for an @AutoValue class. Ideally, there would be a way for Room and AutoValue to work together. That might be as simple as allowing @PrimaryKey and similar annotations to be placed on the getter instead of on the field. OTOH, since AutoValue itself is a code-generator, I can imagine that getting it to co-exist with Room could be... interesting.
Just a thought. Thanks for considering it!