openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Héctor López Fernández (JIRA) <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2367) @Column annotation is ignored when applied onto a setter
Date Wed, 10 Apr 2013 02:24:15 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-2367?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13627395#comment-13627395
] 

Héctor López Fernández commented on OPENJPA-2367:
-------------------------------------------------

Oh, well, when applied onto getters, annotations work as expected. I don't know if the spec
forbids the use of setters for annotating, but there's no error or warning, anyway :-/

Feeling kinda Mr. Premature Poster.
                
> @Column annotation is ignored when applied onto a setter
> --------------------------------------------------------
>
>                 Key: OPENJPA-2367
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2367
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 2.2.1
>         Environment: JRE 1.7, Eclipse Juno, Ant enhancer, Tomcat 7, MySQL 5.5
>            Reporter: Héctor López Fernández
>            Priority: Minor
>
> When mixing AccessTypes (ie. Entity set to FIELD and some member set to PROPERTY), @Column(name="foo")
annotation is ignored if it is applied to a setter (i'm supposing that a getter would yield
same results). This translates to an SQL using the field name as the column name.
> This mapping:
> @Entity
> @Access(AccessType.FIELD)
> @Table(name="posts")
> public class Post extends PersistentObject {
> 	@Basic(optional=false)
> 	@Column(name="publication_date")
> 	@Access(AccessType.PROPERTY)
> 	public void setPublicationDateAsLong(long date) { ... }
> }
> throws this exception:
> org.apache.openjpa.persistence.PersistenceException: Unknown column 't0.publicationDateAsLong'
in 'field list'

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message