Hi,
I use reverse engeneering for nearly 10 years, always the same way:
My collegue gives me a mysql-database which includes the new changes (new tables, new attributes,..)
then I do the reverse engeneering (with eclipse) and get the result in my workspace folder,
a lot of hbm.xml and java files.
!! and now something is very strange....
For existing tables I get some hbm.xml in DOS-Style, with linefeed CR LF, really well formatted,
but for new tables I get hbm.xml files with linefeed LF and very starnge formatted.
Good one, well formatted:
Code:
<property name="nr" type="int">
<column name="Nr" not-null="true">
<comment></comment>
</column>
</property>
Bad one, bad formatted
Code:
<property
name="orderNr"
type="int"
>
<column name="OrderNr" not-null="true" unique="true" >
<comment>Range [1 .. 99], Sortierung Pickliste</comment>
</column> </property>
!! The reason for this strange behavior are comments in the table definition
Table definition with commnts causes bad hbm.xml
Code:
mysql> show create table apwert;
| apwert | CREATE TABLE `apwert` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Version` int(11) NOT NULL,
`OrderNr` int(11) NOT NULL COMMENT 'Range [1 .. 99], Sortierung Pickliste',
`Bez` varchar(30) COLLATE latin1_german1_ci NOT NULL,
`Beschreibung` varchar(80) COLLATE latin1_german1_ci NOT NULL,
`Format` varchar(20) COLLATE latin1_german1_ci NOT NULL COMMENT 'z.B. "%xi{A16.106.n}"',
`MaxWertN` int(11) NOT NULL DEFAULT '1' COMMENT 'Range [1 ... 832]',
`Titel` varchar(20) COLLATE latin1_german1_ci DEFAULT NULL COMMENT 'Template (Vorlage) f³r das Anlegen von neuen VkzDp''s Beispiele: SG, Bus-SG, ...: "SG <n>" QStufe: "QS <n>" ...',
PRIMARY KEY (`Id`),
UNIQUE KEY `UQ_SchGWert_Beschreibung` (`Beschreibung`),
UNIQUE KEY `UQ_SchGWert_Bez` (`Bez`),
UNIQUE KEY `UQ_SchGWert_Format` (`Format`),
UNIQUE KEY `UQ_SchGWert_OrderNr` (`OrderNr`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci |
when I delete the comments, i get well formatted hbm.xmls
Code:
mysql> show create table apwert;
| apwert | CREATE TABLE `apwert` (
`Id` int(11) NOT NULL AUTO_INCREMENT,
`Version` int(11) NOT NULL,
`OrderNr` int(11) NOT NULL,
`Bez` varchar(30) COLLATE latin1_german1_ci NOT NULL,
`Beschreibung` varchar(80) COLLATE latin1_german1_ci NOT NULL,
`Format` varchar(20) COLLATE latin1_german1_ci NOT NULL,
`MaxWertN` int(11) NOT NULL DEFAULT '1',
`Titel` varchar(20) COLLATE latin1_german1_ci DEFAULT NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `UQ_SchGWert_Beschreibung` (`Beschreibung`),
UNIQUE KEY `UQ_SchGWert_Bez` (`Bez`),
UNIQUE KEY `UQ_SchGWert_Format` (`Format`),
UNIQUE KEY `UQ_SchGWert_OrderNr` (`OrderNr`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci |
Code:
<property name="orderNr" type="int">
<column name="OrderNr" not-null="true" unique="true">
<comment></comment>
</column>
</property>
So, what is this about the comments, influence the hbm.xml files??