@Entity
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class Notification {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long notificationId;
private Long businessId;
private String actionBy;
private String date;
private String notification;
public ArrayList<UserNotification> user;
//constructor here
//getters setters here
}
and UserNotification.java is
public class UserNotification {
private Long id;
private String user;
private String notifCount;
//getters setters here
}
I don't know why is it returning null. At what point I made a mistake?
EDIT:
var usersObj=[];
BusinessRoleService.getByBusinessId($sessionStorage.businessRole.business).then(function(response){
if(response.status==200){
for(var x=0;x<response.data.length;x++){
usersObj.push({id: x, user: response.data[x].userId, notifCount: $scope.notification});
}
}
});
var obj = {
"businessId": businessId,
"actionBy": user,
"date": date,
"notification": user+" "+action,
"user": usersObj
}
then I will pass the obj to my service to save
This is what my database looks like after saving