Imagine that I have one common functionality: a series and a number (string and integer) of some document. My object (insurance policy) contains information about the series and the number of different documents, so I would like to group this series and number into one Java object and allow the sleeping storage to store two fields on each object in one table.
See an example:
class Polis {
private DocInfo kaskoNumber;
private DocInfo osagoNumber;
private DocInfo tsNumber;
}
class DocInfo {
private String series;
private Integer number;
}
table:
polis(kaskoSeries varchar2,
kaskoNumber numeric,
osagoSeries varchar2,
osagoNumber numeric..... )
- . , - Polis DocInfo. java, Hibernate, , , ManyToOne (doc_info). !
.