DBに3つのテーブルがあります
- 人
- 住所
- person_address
これはスクリプトSQLです
CREATE TABLE IF NOT EXISTS `address` (
`address_id` int(11) NOT NULL AUTO_INCREMENT,
`address` varchar(30) NOT NULL,
PRIMARY KEY (`address_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
CREATE TABLE IF NOT EXISTS `person` (
`person_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL,
PRIMARY KEY (`person_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
CREATE TABLE IF NOT EXISTS `person_address` (
`person_id` int(11) NOT NULL,
`address_id` int(11) NOT NULL,
PRIMARY KEY (`person_id`,`address_id`),
KEY `address_id` (`address_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `person_address`
ADD CONSTRAINT `person_address_ibfk_2` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `person_address_ibfk_1` FOREIGN KEY (`person_id`) REFERENCES `person` (`person_id`) ON DELETE CASCADE ON UPDATE CASCADE;
これはhibernate.reveng.xmlファイルです
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
<hibernate-reverse-engineering>
<schema-selection match-catalog="manyToManyTest"/>
<table-filter match-name="person_address"/>
<table-filter match-name="address"/>
<table-filter match-name="person"/>
</hibernate-reverse-engineering>
問題は、pojoおよびhbmファイルを生成するときに、personAddress pojoが生成されない(<mapping resource="pojos/PersonAddress.hbm.xml"/>
hibernate.cfg.xmlにエントリがない)ことです。なぜですか?