[hibernate-issues] [Hibernate-JIRA] Created: (ANN-435) multiple @Id attributes not handled correctly

Patrick Moore (JIRA) noreply at atlassian.com
Thu Sep 7 21:33:24 EDT 2006


multiple @Id attributes not handled correctly
---------------------------------------------

         Key: ANN-435
         URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-435
     Project: Hibernate Annotations
        Type: Bug

    Versions: 3.2.0.cr1    
 Environment: hibernate 3.2.0.cr2 hsql 1.8.0.4
    Reporter: Patrick Moore


Defining a class with 2 @Id annotations should report a error or it should work. Instead only the first field with the @Id attribute is marked as a primary key but both are marked as nonnull.

For example:

public class IdUsing2 {
    @Id
    public Integer databaseId;
    @Id @GeneratedValue
    public Long entityId;   
}

results in this SQL:
18:26:57,765 DEBUG [SchemaExport] create table IdUsing2 (entityId bigint not null, databaseId integer not null, idl bigint, value varchar(255), primary key (databaseId))

and no warning or error message.


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