Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Issues List »

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

Anupam M (JIRA)

2008-05-31

Replies: Find Java Web Hosting

Author LoginPost Reply
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

   

_______________________________________________
hibernate-issues mailing list
hibernate-issues@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-issues
©2008 gg3721.com - Jax Systems, LLC, U.S.A.