[hibernate-issues] [Hibernate-JIRA] Created: (ANN-549) Different behavior between annotation and mapping for map key

Anthony Patricio (JIRA) noreply at atlassian.com
Wed Jan 31 04:26:40 EST 2007


Different behavior between annotation and mapping for map key
-------------------------------------------------------------

         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
     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.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list