does it is necessary to define object class for every single table ? if yes then do we have to declare every single column of table in our class as property , say that if i am having a table of countrie’s states so there are more than 200 columns of countries and then there are sates of countries in the rows so how am gonna retrieve the states of America ??
demo table :
Afghanistan | Albania | Algeria | … | Zimbabwe
state 1 state 1 state 1 … state 1
state 2 state 2 state 2 … state 2
state 3 state 3 state 3 … state 3
state 4 state 4 state 4 … state 4
please let me know the most efficient way for getting all the states of America ? and yes please let me know the answer of my question
and my projects are on Java (android) and swift (iOS)
First of all, we strongly not recommend creating huge amount of columns in one table. It may cause serious performance issues and runtime errors if future. We suggest you to re-design your application.
Despite that, you can create Java class only for tables you need. In class you can define only those properties you need.
what you mean by redesign ? how am i going to retrieve data then ? and on the other hand did you mean that we have to create a java class for every single table and we have to define the properties too for every column right ?
Redesign means changing the way you persist data. You need to answer a question “How will I query my data?” and then “How will I persist my data”. Did you also hear about normalization?
In second topic I meant that it is NOT mandatory to define each class or property. You define only those you need.