Question: I am trying to create a script that will display the contents of a folder, onto a newsticker, and I was wondering if anyone had a script that could run this. I was thinking probably php, but it has no been working for me.

Thanks for the help

The software I am using is dreamweaver cs4

Answer: 
Behavior you're describing has **absolutely nothing** to do with associations; you would get the exact same results if you just tried to read / update simple POJO from two entity managers. Once your entity is associated with persistence context it will NOT be automatically refreshed from the database. This is a documented behavior - and in the vast majority of cases this is a DESIRED behavior.

As far as "keeping your application stable" goes:

1. EntityManager instances directly correspond to Hibernate sessions and thus should not be held for prolonged periods of time. If you rewrite your code above to use a new EntityManager instance (em3) instead of reusing em1, your problem will go away.
2. EntityManager has a `refresh()` method which you can invoke to reload entity state from the database.
3. EntityManager has a `clear()` method which will clear the persistence context completely thus preventing this issue as well. Use it sparingly and cautiously, though - invoking `clear()` without `flush()` will throw away all pending updates.
Using `mappedBy` (i.e. bidirectional associations) is not buggy or inconsistent. It is, however, tricky to configure, and you have to be very careful how you use it - it's not a magic bullet, and if you don't follow the programming guidelines, you can get your entities into an inconsistent state.

I tend to avoid them for this reason; I only use them if I *really* need bidirectional associations, in in my experience, that's very rare.