[hibernate-issues] [Hibernate-JIRA] Created: (HBX-1180) hbm2ddl by annotation for compound key with auto-generation

Alex Shubert (JIRA) noreply at atlassian.com
Wed Mar 23 09:12:08 EDT 2011


hbm2ddl by annotation for compound key with auto-generation
-----------------------------------------------------------

                 Key: HBX-1180
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1180
             Project: Hibernate Tools
          Issue Type: Bug
          Components: datagen
         Environment: Hibernate-core 3.5.6 final 
mysql 5.5.10
java 6.23 64bit
            Reporter: Alex Shubert


public class TestRow implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Id
    private Long version;
    
    getters and setters are ommited
}

leads to 

create table F_TESTROW (VERSION bigint not null auto_increment, ID bigint not null, primary key (VERSION, ID))

while http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/ claims that the 

2.2.3.2.4. Partial identifier generation

Hibernate supports the automatic generation of some of the identifier properties. Simply use the @GeneratedValue annotation on one or several id properties.

Anyway, even made by hand correct data structure raises to 
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Long field abc.TestRow.id to org.hibernate.id.IdentifierGeneratorHelper$2


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