I am generating classes for two MySQL tables. The relevant DDL is:
CREATE TABLE RLCMConfig (
ManagedElementId VARCHAR(36) NOT NULL,
PRIMARY KEY (ManagedElementId)
);
CREATE TABLE Service (
ManagedElementId VARCHAR(36) NOT NULL,
ServiceName VARCHAR(64) NOT NULL,
PRIMARY KEY (ManagedElementId, ServiceName),
FOREIGN KEY (ManagedElementId)
REFERENCES RLCMConfiguration(ManagedElementId)
);
A ServiceId class is automatically generated as shown below:
public class ServiceId implements java.io.Serializable {
// Fields
private Rlcmconfig rlcmconfig;
private String serviceName;
// Constructors
…
}
My question is why is the foreign key an instance of the class Rlcmconfig, when I generated comparable classes from the following DDL:
CREATE TABLE Attributes (
AttributeId VARCHAR(64) NOT NULL,
PRIMARY KEY (AttributeId)
);
CREATE TABLE ReportCriteriaRollup (
AttributeId VARCHAR(64) NOT NULL,
TrendNumber INTEGER NOT NULL,
PRIMARY KEY (AttributeId, TrendNumber),
FOREIGN KEY (AttributeId)
REFERENCES Attribute(AttributeId)
);
and I get this class for ReportCriteriaRollupId:
public class ReportcriteriarollupId implements java.io.Serializable {
// Fields
private String attributeId;
private Integer trendNumber;
// Constructors
…
}
These two situations seem to be exactly the same as far as the DDL goes, yet I get very different IDs, the latter being the one I would expect. Does anyone know where the difference comes from – is there some setting that can affect the way these are generated. BTW, I am not using any custom templates in either case.
Thanks.