Hi,

I have a server application that is given a user id, verifies that it exists in one 
table, records an event in a second table, and returns an event count back to the 
requester.  My problem is that the count being returned is not including the last 
event recorded.

Here are the details:

The application consists of an Entity bean to do the verification (using a 
findByXXX()), a session bean to do the event recording, and a straight prepared 
statement query to get the event count.  Here's the psuedo code:

  getUserIdFromClient();
  valid = userhome.findByUserId();
  eventRemote.record(userEvent);
  count = getCountFromEventTable();

The EntityBean uses a "Required" trans-attribute while the event session bean uses a 
"RequiresNew" trans-attribute.  I was coached years ago that it would be better to use 
a session bean when just doing inserts because the overhead of an entity bean would be 
unnecessary.  But it appears to me that some commit isn't happening before the 
getCountFromEventTable() method is being called, so the count is always off by one.  
As I write this, I seem to recall discussions about commit options.  I don't know a 
lot about commit options, so all of mine are at the JBoss default.

Is my assessment of the problem correct?  If so, how do I correct it?  I would rather 
not fool with the commit options.  Is there something in the code I can do to 
guarantee the event insert be committed so I get the right count returned?  Or is 
there something else causing the problem?

Thanx in advance for your help.

Norton


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3841230#3841230

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3841230


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to