]
Gail Badner updated HHH-5937:
-----------------------------
Fix Version/s: (was: 3.6.next)
@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
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 {{(a)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: