[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-549?page=all ]
Emmanuel Bernard updated ANN-549:
---------------------------------
Summary: key column of a true map should be not null when a join table is used
(was: Different behavior between annotation and mapping for map key)
Assign To: Emmanuel Bernard
Of I fixed it to mimic the hbm file behavior: if an association table is involved, the key
colu;m is forced to not null
key column of a true map should be not null when a join table is
used
---------------------------------------------------------------------
Key: ANN-549
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-549
Project: Hibernate Annotations
Type: Bug
Components: binder
Versions: 3.2.1
Environment: H3.2
Reporter: Anthony Patricio
Assignee: Emmanuel Bernard
Fix For: 3.2.2
Attachments: MapNullableColumn_Annotation.zip, MapNullableColumn_Mappings.zip
these metadatas should be considered as equivalent:
@org.hibernate.annotations.MapKeyManyToMany
@ManyToMany(cascade = CascadeType.ALL)
private Map<Security, Position> positions = new HashMap<Security,
Position>();
<map name="positions" table="account_position"
cascade="save-update">
<key column="account_id" />
<map-key-many-to-many class="Security"
column="security_id"/>
<many-to-many class="Position" column="position_id"/>
</map>
But we can from the generated schema that they are not:
- annotation consider the map key as nullable column
create table Account_Position (Account_id varchar(255) not null, positions_id bigint not
null, mapkey_id varchar(255), primary key (Account_id, mapkey_id))
- whereas mapping files consider the map key as a not-nullable column
create table account_position (account_id varchar(255) not null, position_id bigint not
null, security_id varchar(255) not null, primary key (account_id, security_id))
Maybe there are more side effects.
Attached are 2 testcases.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira