openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Leung (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-2358) openjpa-maven-plugin generates wrong sql for derby
Date Tue, 26 Mar 2013 20:47:14 GMT


Ted Leung commented on OPENJPA-2358:

I narrowed it down :)

attached is a test project that shows the problem.

The cause is

@Table(uniqueConstraints = @UniqueConstraint(columnNames = { "localOscarInstanceId", "oscarFacilityId",
"oscarClinicId", "oscarProviderNo", "oscarDemographicId", "dataType" }))

I checked (as well as I could but I'm new to derby) and I don't see any derby restrictions
on indexing null columns and I managed to create a table manually in derby with null columns
in a unique constraint so I think from a DB point of view it should be allowed.

If you remove that @table the generated sql is as expected, if you put it back, it all becomes
"not null". 

> openjpa-maven-plugin generates wrong sql for derby
> --------------------------------------------------
>                 Key: OPENJPA-2358
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: tooling
>    Affects Versions: 2.2.1
>         Environment: linux (fedora 16, x86_64), oracle jdk 1.7.0_17-b02, Maven 3.0.5,
>            Reporter: Ted Leung
>         Attachments: openjpa_derby_test.tar.gz
> model object fields are not defaulting to allow null, even when I explicity set @Column(nullable=true),
it still generates the columns as "not null".
> As an example :
> @Column(nullable = true, length = 128)
> private String dataType;
> results in generated sql of :
> dataType VARCHAR(128) NOT NULL
> This happens for both org.apache.derby.jdbc.ClientDriver, and org.apache.derby.jdbc.EmbeddedDriver.
As a test, I changed the driver to the MySql driver and everything worked as expected so I'm
fairly sure this is not a configuration / setup issue unless there's special configuration
required for derby.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message