lundi 1 octobre 2018

Java DataLayer not working for Conjuntions

I am trying to create Java classes for Queries where I can apply and and or operators.Basically I am trying to create JPA Layer at my end. So let say I have query class with fields f, and value v, I also want to implement And and OR operator for this query. Currently what I have is

class Query{
    String field;
    Object value;
    String tableName;
    Operator operator;

}
enum Operator{
    AND, OR
}

So say if I want to implement select * from table where a = 1 and b = 2; How should I write my class definition so that I can create this.? This is just the database connector layer, I will call corresponding query using this class object. Can you suggest what is the correct way to do the same ?

Aucun commentaire:

Enregistrer un commentaire