Hello,
I'm using Hibernate (using a caveatemptor style DAO pattern), in a standalone application. In my application there are TCP connections which remain open for a considerable amount of time to clients (hours at a time). If I demarcate the transaction boundary at the thread level, will the data not be persisted until the connection (and thus terminating the connection thread) is closed (triggering the end of the transaction)?
If this is the case, should I be manually beginning/ending the transactions where appropriate? i.e. everytime I touch a persisted entity. Or is there a way I can keep the transaction open until the connection thread ends but "flush" the persisted data (saving it to the DB) periodically?
I'd really like to demarcate my transaction boundary at the start of the connection thread and end it when the connection is closed, as this would be really clean. Or am I pushing the concept of a "unit of work" the transaction represents too far?
Any guidance would be appreciated.
Thanks in Advance,
Richard...
|