Entity Person {
reference @Ssn ssn key
........
}
BasicType Ssn {
nogap
String number key
String country key
}
CREATE TABLE PERSON (
ID BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
DESCRIPTION VARCHAR(100),
PERSONNAME BIGINT NOT NULL,
SSN_NUMBER VARCHAR(100) NOT NULL,
SSN_COUNTRY VARCHAR(100) NOT NULL,
GENRE VARCHAR(5),
CREATEDDATE DATETIME,
CREATEDBY VARCHAR(50),
LASTUPDATED DATETIME,
LASTUPDATEDBY VARCHAR(50),
VERSION BIGINT NOT NULL,
CONSTRAINT UNIQUE (
SSN_NUMBER, SSN_COUNTRY
)
);
CREATE TABLE PERSON (
ID BIGINT NOT NULL,
DESCRIPTION VARCHAR(100),
NUMBER_NUMBER VARCHAR(100) NOT NULL,
COUNTRY_COUNTRY VARCHAR(100) NOT NULL,
GENRE VARCHAR(5),
PERSONNAME BIGINT NOT NULL,
CREATEDDATE TIMESTAMP,
CREATEDBY VARCHAR(50),
LASTUPDATED TIMESTAMP,
LASTUPDATEDBY VARCHAR(50),
VERSION BIGINT NOT NULL
);
ALTER TABLE PERSON
ADD CONSTRAINT UQ_PERSON UNIQUE (SSN_NUMBER, SSN_COUNTRY);
Thx for reply Torsten!
So here what i‘ve done :
- Extends Sculptor by overriding OracleDDLTmpl
@ChainOverride
class OracleDDLTmplOverride extends OracleDDLTmpl {
@Inject extension DbHelper dbHelper
@Inject extension PropertiesBase propertiesBase
@Inject extension Helper helper
override def String containedColumns(Reference it, String prefix, boolean parentIsNullable) {
val rows = new StringBuilder()
rows.append(it.to.attributes.filter[a | !a.transient].map[a | ",\n\t" + column(a, getDatabaseName(prefix, it), parentIsNullable || nullable)].join)
rows.append(it.to.references.filter[r | !r.transient && r.to instanceof Enum].map[r | ",\n\t" + enumColumn(r, getDatabaseName(prefix, it), parentIsNullable || nullable)].join)
rows.append(it.to.references.filter[r | !r.transient && r.to instanceof BasicType].map[b | containedColumns(b, getDatabaseName(it), parentIsNullable || nullable)].join)
if (rows.length < 3)
""
else
rows.substring(3)
}
}
I have others extended methods in OracleDDLTmplOverride that work well.
- Adding this project as a dependency of the build :
<plugin>
<groupId>org.sculptorgenerator</groupId>
<artifactId>sculptor-maven-plugin</artifactId>
<version>${sculptor.version}</version>
<configuration>
<verbose>false</verbose>
</configuration>
<executions>
<execution>
<id>cleanup</id>
<goals>
<goal>clean</goal>
</goals>
</execution>
<execution>
<id>code-generation</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
<execution>
<id>image-generation</id>
<goals>
<goal>generate-images</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>my.sculptor</groupId>
<artifactId>ProjectSculptor-generator</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</plugin>
- In my sculptor-generator.properties
db.product=postgresql
generate.ddl=true
I have the same result !! Am I wrong ??
Regards
<groupId>my.toolkit</groupId>
<artifactId>ProjectSculptor-generator</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</plugin>
db.product=postgresql
generate.ddl=true
So i change it to ISO-8859-1, and it's ok. The Sculptor maven plugin can't be set to use UTF-8...?