[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-652) @Length not working for embedded objects
Dirk Lachowski (JIRA)
noreply at atlassian.com
Fri Aug 24 07:01:57 EDT 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27940 ]
Dirk Lachowski commented on ANN-652:
------------------------------------
I've tried @Valid this way:
@Embedded
@AttributeOverrides( {
@AttributeOverride(name="amount", column = @Column(name="amount") ),
@AttributeOverride(name="currencyName", column = @Column(name="currency") )
})
@Valid
public Money getValue() {
return value;
}
But i still get:
create table DDIC.vbak (
...
amount fixed(19,0) null,
currency varchar(255) null, <-- should be shorter
...
);
Looks as if i've done it the wrong way, but i can't see why. Any hint would be great.
> @Length not working for embedded objects
> ----------------------------------------
>
> Key: ANN-652
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-652
> Project: Hibernate Annotations
> Issue Type: Bug
> Affects Versions: 3.2.0.ga
> Environment: hibernate-annotations-3,2,0.GA, MaxDB 7.6.00.27/Linux
> Reporter: Dirk Lachowski
> Priority: Minor
>
> When creating an @Embeddable with a @Length annotated field, the Length is ignored by the entity in which the @Embeddable is embedded.
> Sample:
> @Embeddable
> public class Money {
> ...
> @Length(min=1, max=3)
> protected String getCurrencyName() {
> return currencyName;
> }
> ...
> }
> @Entity
> @Configurable
> public class SalesOrder {
> ...
> @Embedded
> @AttributeOverrides( {
> @AttributeOverride(name="amount", column = @Column(name="amount") ),
> @AttributeOverride(name="currencyName", column = @Column(name="currency") )
> })
> public Money getValue() {
> return value;
> }
> ...
> }
> The generated schema is as follows:
> create table DDIC.vbak (
> id fixed(19,0) not null,
> creationDate timestamp null,
> lastChangedDate timestamp null,
> salesOrderTypeName varchar(6) null,
> orderDate date null,
> orderNumber varchar(10) null,
> orderReference varchar(30) null,
> schemaName varchar(10) null,
> amount fixed(19,0) null,
> currency varchar(255) null, <-- should be varchar(3)
> editable boolean not null,
> customer_id fixed(19,0) null,
> dlvAddr_id fixed(19,0) null,
> owner_id fixed(19,0) null,
> pricelist_id fixed(19,0) null,
> primary key (id)
> );
--
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