ahh!

My thread has the same service bean that is in the main thread has, so I
guess both thread sharing
the same Persentent Context.

Now I need to figure out how to Create my Persitent Context in the child
thread which a little 
disappointed.  My goal is to use the same service bean. Is there a way to
use the same service bean
but with diffrent persistent context?

Thanks for advice

-D

simon-118 wrote:
> 
> ---- Dan Tran <[EMAIL PROTECTED]> schrieb:
>> 
>> 
>> I am running into this problem that I think it is related to the present
>> of
>> Orchestra.
>> 
>> First I have a spring service bean which spins a thread, do the long
>> work,
>> then save some data to persistent in the same thread.  The thread's
>> runnable
>> contructor accept a reference to
>> the the same service bean to do the persistent. It works per my junit
>> test.
>> 
>> Now I hook the same service bean to a couple of my master/detail
>> jsf/spring
>> bean with the same
>> conversation name.  The trouble comes when the service bean try to save
>> the
>> data, ever thing 
>> looks good but no data get saved ( it seems there are no injected
>> transaction)
>> 
>> I also have another unrelated service bean, not related to the
>> conversation
>> , in the same thread and it can save its data.
>> 
>> Any suggestion to this problem is very very appreciated.
> 
> Well, if you're doing stuff in a thread started during a request then you
> had better be using a different persistence context than the one the main
> request is using. Persistence contexts (JPA EntityManager, Hibernate
> Session, etc) are explicitly not thread-safe.
> 
> And of course stuff in the main request thread is going to be messing with
> the transaction associated with its persistence context - committing,
> rolling back, closing the connection, etc.
> 
> If you are using a new persistence context for your thread, then I'm not
> sure what the problem would be, as that new context should have its own
> private Connection which therefore has its own transaction.
> 
> Regards,
> 
> Simon
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-orchestra--unable-to-persist-in-sub-thread-tf4395808.html#a12536974
Sent from the My Faces - Dev mailing list archive at Nabble.com.

Reply via email to