我有一个表@RequestMapping("/person/{id}")
public void showPerson(@PathVaribale Long id, HttpServletResponse response) {
Person person = ...; // load the person from somewhere
String currentCacheControl = response.getHeader("Cache-Control");
if (currentCacheControl == null) currentCacheControl = "";
response.setHeader("Cache-Control", currentCacheControl + "max-age=" + person.getMaxAge());
}
,其中有一个外键companies_employers
,引用了company_id
中的id
。
companies table
我填充CREATE TABLE `companies_employers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(100) DEFAULT NULL,
`last_name` varchar(100) DEFAULT NULL,
`company_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `company_id` (`company_id`),
CONSTRAINT `companies_employers_ibfk` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
然后运行:
companies_employers
SELECT * FROM companies_employers
为空。
现在我跑:
company_id
工作,它给出正确的值。
为什么我无法通过SELECT company_id FROM `companies_employers`
获取它?有人可以解释一下吗?
更新
情景截图: