
|
If you were logged in you would be able to see more operations.
|
|
|
|
|
| Component/s: |
binder
|
| Affects Version/s: |
3.2.0.cr1
|
| Fix Version/s: |
None
|
|
|
Environment:
|
hibernate 3.2.0.cr2 hsql 1.8.0.4
|
|
Issue Links:
|
Duplicate
|
|
This issue duplicates:
|
|
|
ANN-12 @Id on multiple properties
|
|
|
|
|
|
Relates
|
|
|
|
This issue relates to:
|
|
|
ANN-573 Many-to-many with Attributes (Attribute-class with two @ManyToOne mappings as @Id) not possible
|
|
|
|
|
|
|
|
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.
|
|
Description
|
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.
|
Show » |
|
@Entity
public class IdUsing2 {
@Id
public Integer databaseId;
@Id @GeneratedValue
public Long entityId;
public Long idl;
public String value;
}