I want to get actual column name that is in db from entity variable names.
Eg:
i have an entity as below,
@Entity
@Table(name="test_detail",schema = "test")
public class Test {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
@Column(name = "id")
private Long id;
@Column(name="test_status")
private Boolean testStatus;
@Column(name="test_status1")
private Boolean testStatus1;
}
I had populated this entity using springboot repository get/find calls.
Test t = repository.findById(1l);
I have a list L which contains the names of the colums as
['id','test_status']
i need to get the values of column names that are mentioned in the list L.In this case i dont need values present in testStatus1.
How do i do that?
or
Is there any way to get only the values for the columns mentioned in the list directly?
There are few criteria that need to be met:
- Criteria 1 : should not use Namedqueries/@Query annotations
- Criteria 2 : the columns in the List L might vary from request to request. it is generated dynamically.Sometimes all the columns are listed sometimes just one or two columns listed.