openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Chauvet (JIRA)" <j...@apache.org>
Subject [jira] [Created] (OPENJPA-2274) Annotations & interface methods
Date Fri, 05 Oct 2012 10:12:02 GMT
Guillaume Chauvet created OPENJPA-2274:
------------------------------------------

             Summary: Annotations & interface methods
                 Key: OPENJPA-2274
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2274
             Project: OpenJPA
          Issue Type: Improvement
            Reporter: Guillaume Chauvet


Dear OpenJPA team,

I tested a peculiar use of annotations on methods declared into an interface :

public interface EntityHeader {

    public long getId();
}

public interface EntityHistorizable<E extends EntityHeader> {

/* .... other methods ....*/

    @PostLoad
    public void postLoad();
    
    @PrePersist
    public void prePersist();

}

public class Task implements Serializable, EntityHistorizable<Task>, EntityHeader {

/* .... Implementations .... */

    @Override
    public void postLoad() {
	System.out.println("postLoad");
    }

    @Override
    public void prePersist() {
	System.out.println("prePersist");
    }

}


When I perform a persist/find operation on the "Task" entity, OpenJPA don't execute postLoad/prePersist
methods because annotations are applied in the interface. I don't know if it's a good practice,
but it will be useful in the case who want to provide a "pattern" interface, for example.

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