[hibernate-issues] [Hibernate-JIRA] Created: (EJB-364) Composite PK and @GeneratedValue

Radosław Smogura (JIRA) noreply at atlassian.com
Sat May 31 08:00:33 EDT 2008


Composite PK and @GeneratedValue
--------------------------------

                 Key: EJB-364
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-364
             Project: Hibernate Entity Manager
          Issue Type: Bug
    Affects Versions: 3.3.2.GA
         Environment: Hibernate 3.2.6
Glassfish
PostgreSQL
            Reporter: Radosław Smogura
            Priority: Critical


[code]
For class like this
@Entity
@IdClass(FooId.class)
/* Seq / Table generator */
public class Foo {
  int id1;
 int id2;

@Id
public getId1() {
return id1;
}
public setId1(....);

@Id
@GeneratedValue(strategy=AUTO/IDENTITY/SEQUENCE/TABLE)
public int getId2() {
return id2;
}

public void setId2(.....);
}
[/code]
Id1 is set manully, but id2 is unchanged i this situation hibernate doesn't generates PK and tries to insert NULL  causing error.

Specification requires assigning of generated value with @Id properties. Part 2.4.1 defines two types of PKs simple and composite and part 9.1.9 says about PKs in generally.  (SEQ or IDENTITY is specification depended, but PostgreSQL support it and Hibernate should support it too).

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