Answer the question
In order to leave comments, you need to log in
How to organize the storage of a list of objects in the database?
Hello!
The task is to map a certain object in the database (let's call it Sklad) and issue it by REST request. And everything would be fine, but there is an unpleasant moment in all this - the desired object contains an array of other objects (let's call it Good) and a certain number that corresponds to the quantity.
Those. there is a certain dictionary in the database (it maps to the TovarDictionary object), Tovar expands it with a certain number (quantity). And the array of these Goods must be stored in the desired Sklad object, and there are already 7 such objects as Goods. In JAVA it's like this:
public class Sklad {
private long id;
private String name;
private List<Tovar> vars;
private List<Tovar1> vars1;
private List<Tovar2> vars2;
private List<Tovar3> vars3;
private List<Tovar4> vars4;
}
public class Tovar extends С {
private count
}
public class TovarDictionary {
private long id;
private String name;
private String descr;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question