JPA + OrmLIte android: not all of the entity are returned

1

Good evening, I have the following problem.

I'm using JPA with ORMlite to do persistence on Android. I created a class Produto and a Categoria , both of which inherit from an abstract class AbstractEntity .

When querying a product, it brings the category but only with id populated. The descrição and the imagem comes as null .

If I use the query separately, bringing only the category list, all fields are returned.

Follow the class excerpt:

@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class AbstractEntity implements Serializable {

    private static final long serialVersionUID = 35L;

    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;

    @Column(name = "descricao")
    private String descricao;

    @Column(name = "img")
    private Integer img ;

    public AbstractEntity()
    {

    }
}

@Entity(name="categoria")
public class Categoria extends AbstractEntity  {


    private static final long serialVersionUID = 35L;

    public Categoria()
    {
        //this.setId(new Long(0));
        //this.setDescricao("");
    }
}

@Entity(name="produto")
public class Produto extends AbstractEntity  {

    private static final long serialVersionUID = 35L;

    @ManyToOne(cascade=CascadeType.ALL)
    private Categoria categoria;

    public Produto()
    {
        //this.setId(new Long(0));
        //this.setDescricao("");
        //this.setImg(0);
        ///this.categoria = new Categoria();
    }
}
    
asked by anonymous 21.08.2015 / 02:20

0 answers