[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-652) @Length not working for embedded objects

Diego Pires Plentz (JIRA) noreply at atlassian.com
Tue Aug 21 22:14:57 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27910 ] 

Diego Pires Plentz commented on ANN-652:
----------------------------------------

Just to be more clear:

http://www.hibernate.org/hib_docs/validator/api/org/hibernate/validator/Valid.html

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