Hey guys,
Trying to run my simple hosted service called RewardsService that adds a row to a table,
Receiving this response body:
{
“code”: 0,
“message”: “java.lang.NullPointerException: exception during method invocationServiceException”
}
This is my main class:
public class RewardService implements IBackendlessService {
private static final String USER_REWARDS_TABLE_NAME = "userRewards";
private static final String COL_USER_ADVERTISING_ID = "userAdvertisingId";
private static final String COL_NUM_OF_COINS = "numOfCoins";
private static final String COL_EVENT_ID = "eventId";
private static final String COL_REWARD_DATE = "rewardDate";
private static final String COL_AD_NETWORK_NAME = "adNetworkName";
private static final String COL_AD_PROVIDER_NAME = "adProviderName";
public void addReward(Reward reward)
{
// Creating reward row map
Map rewardRowMap = new HashMap();
rewardRowMap.put(COL_USER_ADVERTISING_ID, reward.getUserAdvertisingId());
rewardRowMap.put(COL_NUM_OF_COINS, reward.getNumOfCoins());
rewardRowMap.put(COL_EVENT_ID, reward.getEventId());
rewardRowMap.put(COL_REWARD_DATE, reward.getRewardDate());
rewardRowMap.put(COL_AD_NETWORK_NAME, reward.getAdNetworkName());
rewardRowMap.put(COL_AD_PROVIDER_NAME, reward.getAdProviderName());
// Saving the reward row to the DB
Backendless.Persistence.of(USER_REWARDS_TABLE_NAME).save(rewardRowMap);
}
}also I could not understand if I’m supposed to add the row using Backendless.Persistence, Backendless.Data or Backendless.Cache.
Thanks,Tal