Are you creating the PatientState within an application session in the
first session – calling openSession & closeSession on either end?  When you
saw then session one "inserts a new PatientSate", that means that you are
creating the new object through the API, right?

FWIW, while we're subject to Hibernate unpredictability until our API is
rewritten, having changes to objects sometimes persisted before asking the
API to save them is a smaller problem than calling create or save on an
object and not having those changes reliably persisted.  If the latter is
happening (as your issue suggests), then we need to fix it.

-Burke

On Thu, Dec 29, 2011 at 11:30 AM, McKee, Steven Jay <[email protected]>wrote:

>  I’m currently running OpenMRS 1.7, and I’m seeing an intermittent issue
> across Hibernate sessions in our CHICA code:****
>
> ** **
>
> **1.       **Session one inserts a new PatientState (CHICA specific
> table/object).****
>
> **2.       **A new thread is created to do some processing on the
> PatientState.  The patient state ID is passed to the thread.****
>
> **3.       **Session two is created in the new thread and tries to get a
> PatientState object based on the patient state ID.****
>
> **4.       **The PatientState object is coming back null.****
>
> ** **
>
> It seems as though session one has not committed the new patient state and
> session two is trying to access it.  What is the best Hibernate mechanism
> to use to ensure the patient state is committed to the database before
> session two tries to access it?  Keep in mind the PatientState object is
> being accessed outside the DAO layer.****
>
> ** **
>
> Thanks,****
>
> Steve****
>
> ** **
>  ------------------------------
> Click here to 
> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-devel-l>from 
> OpenMRS Developers' mailing list

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-devel-l" in the  body (not 
the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]

Reply via email to