[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5937) @Enumerated(EnumType.STRING) not taken into account in an @Embeddable included in another @Embeddable

Steve Ebersole (JIRA) noreply at atlassian.com
Wed Dec 14 14:16:21 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44579#comment-44579 ] 

Steve Ebersole commented on HHH-5937:
-------------------------------------

Gail, try the tests I just pushed.  If those pass as well on 3.6 then just close this issue as out of date.  

> @Enumerated(EnumType.STRING) not taken into account in an @Embeddable included in another @Embeddable
> -----------------------------------------------------------------------------------------------------
>
>                 Key: HHH-5937
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5937
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: annotations
>    Affects Versions: 3.6.1
>         Environment: MySQL 5.1.40 / hibernate-entitymanager 3.6.1.Final
>            Reporter: Thomas Vanstals
>            Assignee: Steve Ebersole
>             Fix For: 3.6.next
>
>          Time Spent: 44m
>
> I have a Customer entity containing a collection of Investment. 
> The Investment ({{@Embeddable}}) class contains a MonetaryAmount.
> The MonetaryAmount ({{@Embeddable}}) contains an enumerated property ('currency') annotated with {{@Enumerated(EnumType.STRING)}}.
> The 'currency' field is mapped to a column having the following definition: {{`currency` int(11) DEFAULT NULL}}. This is not correct. The column definition should be {{`currency` varchar(3) DEFAULT NULL}}.
> If a add a MonetaryAmount property in the Customer class, the generated column definition is correct ({{`currency` varchar(3) DEFAULT NULL}}).
> {code:title=Customer.java|borderStyle=solid}
> @Entity
> public class Customer {
>   @Valid
>   @ElementCollection(fetch = FetchType.EAGER)
>   private List<Investment> investments = new ArrayList<Investment>();
> }
> {code}
> {code:title=Investment.java|borderStyle=solid}
> @Embeddable
> public class Investment {
> 	
>   @Valid @NotNull
>   private MonetaryAmount amount;
> 	
>   @Column(length = 500) @Length(max = 500)
>   private String description;
> 	
>   private Date date; 
> 	
> }
> {code}
> {code:title=MonetaryAmount.java|borderStyle=solid}
> @Embeddable
> public class MonetaryAmount {
>   @NotNull
>   private Double amount;
>   @Column(length = 3)
>   @Enumerated(EnumType.STRING)
>   private CurrencyCode currency;
> }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list