On Mon, Aug 11, 2014 at 9:25 AM, Dennis Gesker <dennis_at_gesker.com> wrote:
> Yes. That's the rub. It doesn't.
>
I'm not entirely sure what's going on either, but by any chance is the
Future you're calling get() on an instance of AsyncResult (
http://docs.oracle.com/javaee/7/api/javax/ejb/AsyncResult.html)? Let's
start there. My thinking would be that somewhere in your code you're
invoking an asynchronous EJB method without going through an EJB proxy
first (that is, pullProjectBudget was not injected via @EJB or @Inject but
directly constructed by you), and so the Future you're being handed isn't
really a Future in all the important ways (since AsyncResult#get() just
returns whatever it was built with immediately), and so might be behaving
oddly from your point of view. This is a bit of a sketchy theory but it's
all I can think off offhand.
I noticed (on a different subject) that there's a lot of extraneous usage
of EntityManager#merge() and possibly flush() in the pastebin code as well;
you may want to read up on exactly what a persistence context is. Hint:
merge doesn't mean save. I wrote up a blog article on this some time ago
that may be helpful:
http://lairdnelson.wordpress.com/2013/04/04/the-bag/
Best,
Laird
--
http://about.me/lairdnelson