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

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

Reply via email to