I m writing an application that communicates with a web API, which responds with JSON. Currently, I m translating the JSON objects to Java objects using gson (which is awesome, by the way).
Now, I want to store some of these objects in an SQLite database. However, they have lots of properties that would never be used in queries (i.e. I won t be ORDER
ing, WHERE
ing, or anything like that with those properties), so I feel it s unnecessary to create columns for all of them. What I m thinking of doing is:
- Only have columns for the essential data that will be used when querying the database
- Have one
TEXT
orBLOB
column (which one do you recommend?) that stores the actual JSON, so I can recreate my Java object from it and access all the data.
This would both make my life easier and streamline my code (I would not have to write very different code when dealing with data from the API vs. data from the database).
然而,尽管我看不出底部,但我感觉到底鱼。
如果我使用这一技术,你会遇到什么样的麻烦?