[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5376) Tests contain invalid SQL

Fred Toussi (JIRA) noreply at atlassian.com
Mon Jul 12 21:35:13 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5376?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37745#action_37745 ] 

Fred Toussi commented on HHH-5376:
----------------------------------

Also this test uses the Class$methodName string as a table name. The identifier is illegal in many SQL dialects. If the whole identifier is double quoted, it may be acceptable to most dialects.

As the test is for annotations, this may be a defect in Hibernate annotation support, rather than a test defect.

package org.hibernate.test.annotations.generics;
public class EmbeddedGenericsTest extends TestCase {

    create table Classes$Book (
        id bigint not null,
        name varchar(255),
        primary key (id)
    )

> Tests contain invalid SQL
> -------------------------
>
>                 Key: HHH-5376
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5376
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.5.x
>         Environment: Using HSQLDB 2.0.1 and Hibernate trunk (12 July 2010)
>            Reporter: Fred Toussi
>
> These create table statements declare both primary key and unique constraints on the same set of columns. This is against the SQL standard and will fail with most databases.
> public class DerivedIdentitySimpleParentSimpleDepTest extends TestCase {
> 22:52:06,265 ERROR SchemaExport:386 - Unsuccessful: create table MedicalHistory (lastupdate date, FK varchar(255) not null, primary key (FK), unique (FK))
> 22:52:06,265 ERROR SchemaExport:387 - a UNIQUE constraint already exists on the set of columns in statement [create table MedicalHistory (lastupdate date, FK varchar(255) not null, primary key (FK), unique (FK))]
> public class DerivedIdentityIdClassParentSameIdTypeIdClassDepTest extends TestCase {
> 	
> 	public void testOneToOneExplicitJoinColumn() throws Exception {
> 23:16:18,328 DEBUG SchemaExport:415 - 
>     create table MedicalHistory (
>         FK1 varchar(255) not null,
>         FK2 varchar(255) not null,
>         primary key (FK1, FK2),
>         unique (FK1, FK2)
>     )
> 23:16:18,328 ERROR SchemaExport:386 - Unsuccessful: create table MedicalHistory (FK1 varchar(255) not null, FK2 varchar(255) not null, primary key (FK1, FK2), unique (FK1, FK2))
> 23:16:18,328 ERROR SchemaExport:387 - a UNIQUE constraint already exists on the set of columns in statement [create table MedicalHistory (FK1 varchar(255) not null, FK2 varchar(255) not null, primary key (FK1, FK2), unique (FK1, FK2))]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list