Answer the question
In order to leave comments, you need to log in
Spring lookup tables how to use them?
Good afternoon!
Before that, I did not use ORM, and therefore questions arise.
There is a reference table, say the type of document + additional characteristics of a particular type.
CREATE TABLE IF NOT EXISTS `doc_types` (
`id` int NOT NULL,
`name` varchar(255) NOT NULL,
UNIQUE KEY (`id`)
) DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `docs` (
`id` int NOT NULL,
`documentType`int NOT NULL,
`content` varchar(200) NOT NULL,
PRIMARY KEY (`id`,`documentType`)
) DEFAULT CHARSET=utf8;
INSERT INTO `doc_types` (`id`, `name`) VALUES
(1, 'Внутренний оборот'),
(2, 'Внешний оборот'),
(3, 'Сервисный документ');
INSERT INTO `docs` (`id`, `documentType`, `content`) VALUES
('1', 1, 'Какой-то внутр документ'),
('2', 1, 'Какой-то внутр документ'),
('1', 2, 'Какой-то внеш документ'),
('1', 3, 'Какой-то сервисный документ');
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