openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2367) @Column annotation is ignored when applied onto a setter
Date Wed, 10 Apr 2013 14:06:15 GMT

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

Albert Lee commented on OPENJPA-2367:
-------------------------------------

Per "2.3.1 Default Access Type
...
• When property-based access is used, the object/relational mapping annotations for the
entity class annotate the getter property accessors[7],
...
[7] These annotations must not be applied to the setter methods."

Since the spec is very specific on this matter, only getters are scanned for property access
type.

Hope this help.
Albert Lee.
                
> @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