| Summary: | Option to NOT apply the name strategy to names specified explicitly via JPA annotations | ||
|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Nikita <d.nikita.e> |
| Component: | Teneo | Assignee: | Martin Taal <mtaal> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Nikita
The latest build of Teneo contains a new option: teneo.naming.auto_adapt_manual_set_sql_names the default is true (for backward compatibility). In your case you want to set this to false. Can you test if it works for you? gr. Martin I ran into an issue with the DDL generated for some types whose column names are reserved keywords. For this XSD:
<xsd:complexType name="Attributes">
<xsd:attribute name="string" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">@Column(nullable="true")
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="integer" type="xsd:integer">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">@Column(nullable="true")
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
<xsd:complexType name="RecordWithListOfRecordsWithAttributes">
<xsd:sequence>
<xsd:element name="recordList" type="Attributes"
minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">@Column(nullable="true")
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
The DDL generated using AUTO_ADAPT_MANUAL_SET_SQL_NAMES=true looks like this (note the quoting of the "integer" and "string" cols):
create table `attributes` (
a_id bigint not null auto_increment,
`integer` decimal(19,2),
`string` varchar(255),
`rcrdwthlstfrcrdsw_rcrdlst_d` bigint,
`rcrdwthlstfrcrds_rcrdlst_dx` integer,
primary key (a_id)) ENGINE=InnoDB
The DDL generated using AUTO_ADAPT_MANUAL_SET_SQL_NAMES=false looks as follows (the "integer" and "string" cols are not quoted):
create table `attributes` (
a_id bigint not null auto_increment,
integer decimal(19,2),
string varchar(255),
`rcrdwthlstfrcrdsw_rcrdlst_d` bigint,
`rcrdwthlstfrcrds_rcrdlst_dx` integer,
primary key (a_id)) ENGINE=InnoDB
[main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - Unsuccessful: create table `attributes` (a_id bigint not null auto_increment, integer decimal(19,2), string varchar(255), `rcrdwthlstfrcrdsw_rcrdlst_d` bigint, `rcrdwthlstfrcrds_rcrdlst_dx` integer, primary key (a_id)) ENGINE=InnoDB
[main] ERROR org.hibernate.tool.hbm2ddl.SchemaExport - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'integer decimal(19,2), string varchar(255), `rcrdwthlstfrcrdsw_rcrdlst_d` bigint' at line 1
It looks like with this option set to false, column names don't get quoted, which causes a database error when the name happens to be a reserved keyword. The fields are actually not specifying the name explicitly; they are only using the @Column annotation to set the nullability.
I published a new build which should solve this (also escape names even if they are not truncated). gr. Martin |