java - Better design approach for having a variable in a class not present in Database -


say have class:

class x {   private int a;   private int b;   private int c; }  id & d list well. list<x> result = getresult(id, d); 

now while processing result, have d well. 1 way can think of adding variable d in class x, , make getresult keep appending d.

getresult(id, d) {         foreach id {             x x = databasecall(id);             x.d = d;             result.add(x);         }         return result;     } 

the drawback approach class x no longer has values based on columns in db. there better way?

just add @transient annotation on field should not been persisted.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -