23.12.2012 Views

ZK Developer's Guide

ZK Developer's Guide

ZK Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Integration with Other Frameworks<br />

<br />

<br />

<br />

PROPAGATION_REQUIRED<br />

PROPAGATION_REQUIRED<br />

PROPAGATION_REQUIRED<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

In short we have learned how to use Spring with <strong>ZK</strong> and about the configurations.<br />

We have seen that the integration is quite smooth and also powerful.<br />

Hibernate<br />

Well, Hibernate has really nothing to do with a view layer so why are we talking<br />

here about this issue?<br />

Normally, Hibernate is used along with Spring to take care of the database<br />

transactions. In the Spring sample the section above in we have also shown<br />

the integration of Hibernate to do the mapping and DAO handling. However,<br />

unfortunately there is a downer. Hibernate has a different session management.<br />

Unlike the <strong>ZK</strong> multi-threaded environment, Hibernate handles all data accessing<br />

operations in one session. To solve this problem the creators of <strong>ZK</strong> developed their<br />

own <strong>ZK</strong> listener for Hibernate.<br />

This listener has to be configured in the zk.xml:<br />

<br />

Hibernate thread session context<br />

handler<br />

<br />

[ 132 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!