[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-824) Annotations - MSSQL, DB2, Sybase - Nullable Foreign PK not allowed

Emmanuel Bernard (JIRA) noreply at atlassian.com
Thu May 7 04:15:15 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33120#action_33120 ] 

Emmanuel Bernard commented on ANN-824:
--------------------------------------

which column is failing? Something in AddressEntryPK? Then I think the workaround is to mark AddressEntryPK columns as not null

> Annotations - MSSQL, DB2, Sybase - Nullable Foreign PK not allowed
> ------------------------------------------------------------------
>
>                 Key: ANN-824
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-824
>             Project: Hibernate Annotations
>          Issue Type: Bug
>         Environment: MSSQL, DB2, Sybase
>            Reporter: Gail Badner
>            Assignee: Emmanuel Bernard
>             Fix For: 3.5
>
>
> MSSQL, DB2, and Sybase require primary key columns to be non-nullable. Some unit tests are failing using those DBs  because a primary keys are defined with one or more nullable columns. This is happening with both trunk and v3_3_1_GA_CP.
> I see other JIRA issues that sound related that are marked as fixed, so I'm surprised to see these failing in trunk. 
> HHH-1935 sounds related. It mentions a bug in SchemaUpdate using @MapKey with @CollectionOfElements.
> Workarounds are:
> - add "nullable=false" to @JoinColumn
> - add "optional=false" to @ManyToOne
> - add an @AttributeOverride with @Column(name="mapkey", nullable=false) in case of a @CollectionOfElements using a Map
> - add "nullable=false" in @Column when inside a @CollectionId or inside @MapKey
> I've included the table DDL causing the failure. Also, there were some tests I couldn't get to pass using a workaround. 
> org.hibernate.test.annotations.any.AnyTest
>     create table map_properties ( map_id int not null, property_type varchar(255) null,
>          property_id int not null, map_key varchar(255) null, primary key (map_id, map_key) )
> org.hibernate.test.annotations.cid.CompositeIdTest
>     create table A ( bid numeric(19,0) null, cid numeric(19,0) null, primary key (bid, cid) )
>     create table Child ( nth int not null, parentFirstName varchar(255) null, parentLastName varchar(255) null,
>         primary key (nth, parentFirstName, parentLastName) )
>     create table TvMagazin ( time datetime null, chan_id int null, presenter_name varchar(255) null,
>         primary key (chan_id, presenter_name) )
>     create table TvProgram ( time datetime null, channel_id int null, presenter_name varchar(255) null,
>         primary key (channel_id, presenter_name) )
>     create table TvProgramIdClass ( time datetime null, channel_id int null, presenter_name varchar(255) null,
>         primary key (channel_id, presenter_name) )
> org.hibernate.test.annotations.collectionelement.CollectionElementTest
>     create table Matrix_values ( Matrix_id int not null, element float null, mapkey int null,
>         primary key (Matrix_id, mapkey) )
>     create table ScorePerNickName ( BoyId int not null, fld_score int null, mapkey varchar(255) null,
>         primary key (BoyId, mapkey) )
>     create table TestCourse_variations ( TestCourse_testCourseId numeric(19,0) not null,
>         element varchar(255) null, language_code varchar(255) null,
>         primary key (TestCourse_testCourseId, language_code) )
> org.hibernate.test.annotations.collectionelement.indexedCollection.IndexedCollectionOfElementsTest.testIndexedCollectionOfElements
>     create table contact ( n_key_person int not null, name varchar(255) null, n_key_contact numeric(19,0) null,
>         primary key (n_key_contact) )
> org.hibernate.test.annotations.identifiercollection.IdentifierCollectionTest.testIdBag
> NOTE: I could not find a workaround to fix this test.
>     create table PASSPORT_STAMP ( Passport_passport_id numeric(19,0) not null,
>         stamps_id numeric(19,0) not null, COLLECTION_ID numeric(19,0) null,
>         primary key (COLLECTION_ID) )
>     create table PASSPORT_VISASTAMP ( Passport_passport_id numeric(19,0) not null,
>         visaStamp_id numeric(19,0) not null, COLLECTION_ID numeric(19,0) null,
>         primary key (COLLECTION_ID) )
> org.hibernate.test.annotations.indexcoll.IndexedCollectionTest
>     create table Atmosphere_Gas ( Atmosphere_id int not null, gases_id int not null,
>         gas_name varchar(255) null, primary key (Atmosphere_id, gas_name) )
> org.hibernate.test.annotations.target.TargetTest
> NOTE: I could not find a workaround to fix this test.
>     create table Brand_LuggageImpl ( Brand_id numeric(19,0) not null,
>         luggagesBySize_id numeric(19,0) not null, name varchar(255) null,
>         primary key (Brand_id, name) ) 

-- 
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