Object is null
Closed this issue · 1 comments
brunocascio commented
Reponse from loopback api:
[
{
"name": "Receta 1",
"description": "descripcion de la receta 1",
"servings": 4,
"preparing_time": 3847384,
"cooking_time": 2328738,
"createdAt": "2015-03-05T16:30:34.000Z",
"userId": 1,
"id": 1,
"user": {
"firstName": "Bruno",
"lastName": "Cascio",
"username": "brunocascio",
"email": "foo@bar.com",
"facebook_id": null,
"city": null,
"createdAt": "2015-03-05T16:30:34.000Z",
"modifiedAt": "2015-03-05T16:30:34.000Z",
"id": 1
},
"likes": [
{
"recipeId": 1,
"userId": 1
}
],
"ingredients": [],
"images": []
}
]
How to define java class for user
?
public class Recipe extends Model {
....
private User user;
....
}
public class User extends Model {
....
private String firstName;
....
}
*NOTE: * User model is a custom model, not loopback user.
In java, user
throws a NullPointerException