[hibernate-issues] [Hibernate-JIRA] Commented: (HCANN-23) @Columm does not override column name for join table

Lynn Keeling (JIRA) noreply at atlassian.com
Wed Apr 28 15:04:30 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HCANN-23?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=36770#action_36770 ] 

Lynn Keeling commented on HCANN-23:
-----------------------------------

{code}

public class Territory implements Serializable { 
    private static final long serialVersionUID = -8906914598601073008L; 

    @Id 
    @Column(name = "TERRITORY_ID", length = 50) 
    private String territoryId; @ElementCollection(fetch = FetchType.LAZY) 

    @CollectionTable(name="TERRITORY_CHARACTER", joinColumns=@JoinColumn(name="TERRITORY_ID")) 
    @Column(name="CHARACTER_ID") private Set<Character> characters; 
    ... 
}

public class Character implements Serializable { 
    private static final long serialVersionUID = 845127746329423630L; 

    @Id 
    @GeneratedValue(strategy = GenerationType.AUTO) 
    @Column(name = "CHARACTER_ID") 
    private Long characterId; 
    ... 
}

{code}

> @Columm does not override column name for join table
> ----------------------------------------------------
>
>                 Key: HCANN-23
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HCANN-23
>             Project: Hibernate Commons Annotations
>          Issue Type: Bug
>         Environment: Hibernate Annotions 3.5.1-Final
> MySQL 5.1
>            Reporter: Lynn Keeling
>            Priority: Minor
>
> Using the code below, when the table TERRITORY_CHARACTER is created, two columns are created: TERRITORY_ID and characters_CHARACTER_ID.  Shouldn't the @Column annotation override the default name and create a column called CHARACTER_ID instead of characters_CHARACTER_ID?
> <code>
> public class Territory implements Serializable {
>     private static final long serialVersionUID = -8906914598601073008L;
>     @Id
>     @Column(name = "TERRITORY_ID", length = 50)
>     private String territoryId;
>     @ElementCollection(fetch = FetchType.LAZY)
>     @CollectionTable(name="TERRITORY_CHARACTER", joinColumns=@JoinColumn(name="TERRITORY_ID"))
>     @Column(name="CHARACTER_ID")
>     private Set<Character> characters;
>     ...
> }
> public class Character implements Serializable {
>     private static final long serialVersionUID = 845127746329423630L;
>     @Id
>     @GeneratedValue(strategy = GenerationType.AUTO)
>     @Column(name = "CHARACTER_ID")
>     private Long characterId;
>     ...
> }
> </code>

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