Package org.apache.cayenne.jpa.map

Examples of org.apache.cayenne.jpa.map.JpaLifecycleCallback


    protected boolean processAnnotations(Method method, JpaEntityListener listener) {
        boolean hasListenerAnnotations = false;

        if (method.isAnnotationPresent(PrePersist.class)) {
            listener.setPrePersist(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostPersist.class)) {
            listener.setPostPersist(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PreRemove.class)) {
            listener.setPreRemove(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostRemove.class)) {
            listener.setPostRemove(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PreUpdate.class)) {
            listener.setPreUpdate(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostUpdate.class)) {
            listener.setPostUpdate(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostLoad.class)) {
            listener.setPostLoad(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        return hasListenerAnnotations;
    }
View Full Code Here


    protected boolean processAnnotations(Method method, JpaEntityListener listener) {
        boolean hasListenerAnnotations = false;

        if (method.isAnnotationPresent(PrePersist.class)) {
            listener.setPrePersist(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostPersist.class)) {
            listener.setPostPersist(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PreRemove.class)) {
            listener.setPreRemove(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostRemove.class)) {
            listener.setPostRemove(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PreUpdate.class)) {
            listener.setPreUpdate(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostUpdate.class)) {
            listener.setPostUpdate(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostLoad.class)) {
            listener.setPostLoad(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        return hasListenerAnnotations;
    }
View Full Code Here

        public void onStartElement(
                AnnotatedElement element,
                AnnotationProcessorStack context) {

            Method m = (Method) element;
            updateEntity((JpaAbstractEntity) context.peek(), new JpaLifecycleCallback(m
                    .getName()));
        }
View Full Code Here

    protected boolean processAnnotations(Method method, JpaEntityListener listener) {
        boolean hasListenerAnnotations = false;

        if (method.isAnnotationPresent(PrePersist.class)) {
            listener.setPrePersist(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostPersist.class)) {
            listener.setPostPersist(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PreRemove.class)) {
            listener.setPreRemove(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostRemove.class)) {
            listener.setPostRemove(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PreUpdate.class)) {
            listener.setPreUpdate(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostUpdate.class)) {
            listener.setPostUpdate(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        if (method.isAnnotationPresent(PostLoad.class)) {
            listener.setPostLoad(new JpaLifecycleCallback(method.getName()));
            hasListenerAnnotations = true;
        }

        return hasListenerAnnotations;
    }
View Full Code Here

        JpaEntityListeners listeners = new JpaEntityListeners();
        defaults.setEntityListeners(listeners);

        JpaEntityListener l1 = new JpaEntityListener();
        l1.setClassName("abc.C1");
        l1.setPostLoad(new JpaLifecycleCallback("xpl1"));
        l1.setPreRemove(new JpaLifecycleCallback("xpr1"));
        listeners.getEntityListeners().add(l1);

        JpaEntityListener l2 = new JpaEntityListener();
        l2.setClassName("abc.C2");
        l2.setPostLoad(new JpaLifecycleCallback("xpl2"));
        l2.setPreRemove(new JpaLifecycleCallback("xpr2"));
        listeners.getEntityListeners().add(l2);

        DataMap cayenneMap = new DataMapConverter().toDataMap("n1", context);
        Collection<EntityListener> entityListeners = cayenneMap
                .getDefaultEntityListeners();
View Full Code Here

       
        JpaEntity jpaEntity = new JpaEntity();
        jpaEntity.setName("E1");
        jpaEntity.setClassName("abc.C2");
        jpaEntity.setTable(table);
        jpaEntity.setPostLoad(new JpaLifecycleCallback("xpl2"));
        jpaEntity.setPreRemove(new JpaLifecycleCallback("xpr2"));
        jpaMap.getEntities().add(jpaEntity);

        DataMap cayenneMap = new DataMapConverter().toDataMap("n1", context);

        ObjEntity entity = cayenneMap.getObjEntity("E1");
View Full Code Here

       
        JpaEntity jpaEntity = new JpaEntity();
        jpaEntity.setName("E1");
        jpaEntity.setClassName("abc.C2");
        jpaEntity.setTable(table);
        jpaEntity.setPostLoad(new JpaLifecycleCallback("xpl2"));
        jpaEntity.setPreRemove(new JpaLifecycleCallback("xpr2"));
        jpaMap.getEntities().add(jpaEntity);

        JpaEntityListeners listeners = new JpaEntityListeners();
        jpaEntity.setEntityListeners(listeners);

        JpaEntityListener l1 = new JpaEntityListener();
        l1.setClassName("abc.C1");
        l1.setPostLoad(new JpaLifecycleCallback("xpl1"));
        l1.setPreRemove(new JpaLifecycleCallback("xpr1"));
        listeners.getEntityListeners().add(l1);

        JpaEntityListener l2 = new JpaEntityListener();
        l2.setClassName("abc.C2");
        l2.setPostLoad(new JpaLifecycleCallback("xpl2"));
        l2.setPreRemove(new JpaLifecycleCallback("xpr2"));
        listeners.getEntityListeners().add(l2);

        DataMap cayenneMap = new DataMapConverter().toDataMap("n1", context);

        ObjEntity entity = cayenneMap.getObjEntity("E1");
View Full Code Here

TOP

Related Classes of org.apache.cayenne.jpa.map.JpaLifecycleCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.