Vladimir Galcenco

Greenhorn
+ Follow
since Mar 23, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vladimir Galcenco

Can you start your code in debug mode? Then after stepping through each line use netstat command in your cmd to see when the connection is created?
Could you post the loop as well? I'd like to see when and how your job id changes.

Campbell Ritchie wrote:Yes, it did say not final. That sounds like one of those programming things one uses only as a party trick, or for interview questions



Definitely agree. If you want a an example of an immutable class have a look at String or BigDecimal classes. Otherwise its one of those questions I think.
12 years ago
Hi,

I think the first thing to keep in mind here is that lazy loading should work when Employee entity is attached(managed) to the persistence context.
In order for the entity to be attached to a persistence context you should be running within an active JTA transaction with a Transaction scoped entity manager.
Alternatively, if you use an Extended Persistence context your entities remain managed even if no transaction is present.

1) A transaction would be required for the following code:


2) No transaction required if you use a an extended PersistenceContext, although this code is valid in Stateful beans only, or in J2SE (RESOURCE_LOCAL) persistence context.


By the way is there a reason why you obtain your EntityManager via JNDI lookup?