-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Which jpa method called on collections in OneToMany
PostPosted: Thu Mar 10, 2011 6:31 pm 
Newbie

Joined: Thu Mar 10, 2011 6:06 pm
Posts: 1
My Spring/Hibernate Versions:
spring 2.5.6
hibernate-3.2.2.ga
hibernate-annotations-3.2.1.ga
hibernate-entitymanager-3.2.1.ga

I have an AspectJ pointcut that is intercepting the known 'save/update' methods for a JPA EntityManager but am unsure how to know during a cascading-save what method is actually being called on the children???

The documentation claims:
#If a parent is passed to persist(), all children are passed to persist()
#If a parent is passed to merge(), all children are passed to merge()
#If a parent is passed to save(), update() or saveOrUpdate(), all children are passed to saveOrUpdate()
#If a transient or detached child becomes referenced by a persistent parent, it is passed to saveOrUpdate()

Here is scenario :
Code:
ParentObject parentObject = entityManger.find( ... );

parentObject.addChild(new ChildObject());
parentObject.addChild(new ChildObject2());
parentObject.addChild(new ChildObject3());

entityManger.persist(parentObject);

While the pointcut catches the persist on the parentObject, it seems to not know or catch which method updates/saves the childObject.

Any answers would be great.

Ive been able to intercept all calls to merge/persist/remove without an issue, but on a collection it seems to be missing...... (keep in mind parentObject and childObject are two different Objects types and I can see the parentObject in a persist( ) but the childObject I can't seem to know which method it is using)

Here are my pointcuts.
Code:
    @Pointcut("call(void javax.persistence.EntityManager.persist(*))")
    public void weaveInGlobalPersistenceChecks() {}
   
    @Pointcut("call(* javax.persistence.EntityManager.merge(*))")
    public void weaveInGlobalMergeChecks() {}   

    @Pointcut("call(void javax.persistence.EntityManager.remove(*))")
    public void weaveInGlobalDeleteChecks() {}


What could I be missing? How can I log what is saving the childObjects?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.