The last few days I played around with Android and Jetpack. I used Room for storing my data on a local DB. By now all is running fine, but I want to simplify and reorder my code.

So I am wondering if it is possible to split the @Entity class for my Tables into a KEY class (including all key values) and a DO class (including non key values)!?

For information: I used this method for a personal JAVA project and I am thinking it is a really nice way to keep everything structured and it is easier to keep an overview!


1 Answers

Borchaniz On

I believe that is possible, you just need to declare your key class, Do class then define a TypeConverter for each of them. a TypeConverter defines how complex objects are stored in database (for instance data objects). Please refer to this documentation article: