I have a fairly simple problem. I need to get likeness a tree from the result of the stored procedure. But unfortunately all the examples I've found, used or tables, or uniform structure of the tree.
Stored procedure can return:
| firm_id | index_id | value |
| 1 | 101 | 123 |
| 1 | 102 | 123 |
| 2 | 101 | 123 |
I'm trying to divide by class:
@Entity
@NamedNativeQuery(
name = "getReport",
resultClass = Report.class,
query = "{call myProc(?)}",
callable = true
)
public class Report {
@Id
@Column(name = "firm_id")
private long firmId;
@Embedded
private List<Index> indexList;
// getters and setters
}
Second class:
@Embeddable
public class Index {
@Column(name = "index_id")
private long indexId;
@Column(name = "value")
private int value;
// getters and setters
}
As a result I get a null. I also tried using @ManyToOne/@OneToMany, but received "Table not found". What am I doing wrong?
Thank you for your attention.