Issue Details (XML | Word | Printable)

Key: NUCMONGODB-79
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: No Testcase No Testcase
Assignee: Unassigned
Reporter: Chris Rued
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store MongoDB

@PostLoad not being called after a query

Created: 31/May/12 05:48 PM   Updated: 18/Jun/12 10:05 AM   Resolved: 15/Jun/12 08:58 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Datastore: MongoDB


 Description  « Hide
I can produce a test case showing this if you like, but don't have time at the moment and just wanted to record what I observed...

If I add a @PostLoad annotation to a method in a JPA Entity like so:

    @PostLoad
    private void postLoad() {
        System.err.println("POST LOAD CALLED!!!");
    }

The post load is not invoked when I execute a query and iterator over the result list...e.g.:

        // @PostLoad is not called when executing this query or iterating over results
        Query q = entityManager.createQuery("SELECT e FROM ExampleEntity e");
        List<ExampleEntity > resultList = q.getResultList();
        for ( ExampleEntity ee : resultList ) {
            System.err.println("found: " + ee);
        }

It looks like the @PostLoad method is called if I load the entity directly using the EntityManager.find() method:

        // @PostLoad is called as a result of the find() method being called
        ExampleEntity find = entityManager.find(ExampleEntity.class, "8a9981073784a72b013784a72b440000");



Andy Jefferson added a comment - 31/May/12 07:19 PM
Don't see what this has to do with the MongoDB plugin; store plugins don't handle lifecycle events - that's core or "api.jdo"/"ajp.jpa".
I also cannot reproduce any such issue with JPA and postLoad ... using DN tests or the JPA1 TCK. Obviously I'm using latest code on all plugins. As for anyone else raising an issue, a testcase is prerequisite for anything, unless the raiser is going to debug/fix it themselves.

Andy Jefferson made changes - 31/May/12 07:19 PM
Field Original Value New Value
Priority Major [ 3 ] Incomplete [ 6 ]
Chris Rued added a comment - 31/May/12 08:04 PM
Thanks for looking into it. I only filed it under the MongoDB plugin because that is the data store I was using when I observed it.

I'll try it on the latest code. If I am able to reproduce it, I will provide a test case to illustrate how.

Andy Jefferson made changes - 15/Jun/12 08:58 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Cannot Reproduce [ 5 ]
Andy Jefferson made changes - 18/Jun/12 10:05 AM
Status Resolved [ 5 ] Closed [ 6 ]