Manage Targets

Coherence Target

Datatypes supported in the POJO class

The following data types are supported in the POJO class:
  • java.lang.String
  • java.lang.Integer
  • java.lang.Long
  • java.lang.Float
  • java.lang.Double
  • java.lang.Boolean
  • java.math.BigDecimal
  • java.math.BigInteger

Sample POJO Class

public class OrderPOJO implements Serializable{
private String orderId ;
Private String orderDesc;

public String setOrderId(String str1) {
         this.orderId=str1;
}
public String setOrderDesc(String str2) {
        this.orderDesc=str2;
}

public String getOrderId() {
return orderId;
}
public String getOrderDesc() {
return orderDesc;
}
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
if (!super.equals(object)) return false;
OrderPOJO that = (OrderPOJO) object;
return java.util.Objects.equals(orderId, this.orderId) &&
java.util.Objects.equals(orderDesc, this.orderDesc);
}
public int hashCode() {
return java.util.Objects.hash(super.hashCode(), orderId, orderDesc);
}
}

Note:

Ensure that the POJO class does not have a GGSA coherence target as a constructor, because it can instantiate the POJO class using default constructor, and then access the setXXX and getXXX, and isXXX methods.

Sample Code Snippet to declare a Method which returns Boolean

If a method in the POJO class returns a Boolean value, prefix the method name with is instead of get, while defining the POJO class.

Class Abc {

private boolean var1;

public setVar1(boolean aa){
this.var1 = aa;
}
public boolean isVar1(){
return var1;
}
}