-
1. Re: How Flexible are Seam Managed Transactions?
dhinojosa Jun 8, 2008 9:05 AM (in response to gothmog)Just wondering, are these file uploads occurring during a conversation? If so, how long are your conversations? I think the default is 2 minutes in components.xml.
Let us know.
-
2. Re: How Flexible are Seam Managed Transactions?
gothmog Jun 8, 2008 9:58 AM (in response to gothmog)Hi Dan,
The scope of the class is EVENT. However there is a conversation running as the candidate is injected into the UploadAction. Essentially the code looks like the following:
@Name("upload") @Scope(ScopeType.EVENT) public class UploadAction { ... @In private Candidate candidate; public void upload() { // create the file reference VideoFileReference ref = new VideoFileReference(); ... entityManager.persist(ref); candidate.getVideos().add(ref); entityManager.merge(candidate); ... // does the conversion here } }
The persit line stores a DelayedPostInsertIdentifier and the exception happens on the merge line two lines later.
Cheers
Troy
-
3. Re: How Flexible are Seam Managed Transactions?
gothmog Jun 8, 2008 11:27 AM (in response to gothmog)After experimenting with the jboss JTA settings and changing timeouts, this confirms what I thought.
If I increase the timeout to 600 secs then we can upload bigger files (40mb). If I decrease it to 30 secs then all of a sudden we get the error with 1mb files.
So I guess I really need a way to control that start of that transaction and have it start after the uploaded data has finished streaming to the server :)
Cheers
Troy
-
4. Re: How Flexible are Seam Managed Transactions?
dan.j.allen Jun 10, 2008 3:58 AM (in response to gothmog)Great use case. Here's what you can do. While Seam manages transactions around the request, you still have full access to it as well. Create a PhaseListener and disable the transaction around the UPDATE_MODEL_VALUES phase. You do this by committing the transaction before the phase:
Transaction.instance().commit()
and starting it again after the phase
Transaction.instance().begin()
I once had to do this to get fine-grained control over transactions in an action method. Remember, Seam helps you, it doesn't force you. Do what you feel is necessary. Let us know how it works out.