From: Bill J. (JIRA) <no...@at...> - 2006-07-24 15:29:13
|
Hibernate produces invalid "create table" SQL for Maps on SQL Server 2000 ------------------------------------------------------------------------- Key: HHH-1935 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1935 Project: Hibernate3 Type: Bug Versions: 3.2.0.cr2 Environment: Hibernate 3.2.0.cr2 Microsoft SQL Server 2000 Reporter: Bill Johnson I have two cases where Hibernate3 produces invalid SQL for MS SQL Server 2000: Case 1: @CollectionOfElements @org.hibernate.annotations.MapKey protected Map<String, String> properties; Case 2: @ManyToMany @MapKeyManyToMany private Map<A, B> b; In Case 2, A and B are entities creating a ternary relationship between the parent class, A and B, and I get the following log output: ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - <Unsuccessful: create table A_B (A_id numeric(19,0) not null, b_id numeric(19,0) not null, key_id numeric(19,0) null, primary key (A_id, key_id), unique (key_id))> ERROR [org.hibernate.tool.hbm2ddl.SchemaUpdate] - <Cannot define PRIMARY KEY constraint on nullable column in table 'A_B'.> Hibernate should not attempt to create a nullable primary key column by default on MS SQL Server. -- 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 |