Friday, 19 April 2013

ZK MVVM Form Binding CRUD with Spring and Hibernate

In this series of articles, we will see examples for various concept of ZK Framework.

About the application
This is a small application to store the users information such as first name, last name, email, login id , password, etc. We will have the listing screen which will display all the users in the database. And from this listing screen, we will be able to add new users and edit the existing users in the database.

MySQL table structure.

CREATE TABLE `userprofile` (
`firstname` VARCHAR(50) NOT NULL,
`lastname` VARCHAR(50) NOT NULL,
`middlename` VARCHAR(2) DEFAULT NULL,
`userAccountNumber` VARCHAR(50) NOT NULL,
`address1` VARCHAR(200) NOT NULL,
`address2` VARCHAR(200) DEFAULT NULL,
`city` VARCHAR(100) NOT NULL,
`state` VARCHAR(2) NOT NULL,
`zipcode` VARCHAR(12) NOT NULL,
`email` VARCHAR(100) NOT NULL,
`userloginid` VARCHAR(20) NOT NULL,
`password` VARCHAR(50) NOT NULL,
`system` INT(11) DEFAULT '0',
`userPhoto` LONGBLOB,

Insert some records in the database for the above table

Technologies Used
    1. ZK 6.5.2 CE Version
    3. Hibernate Core Version 4.1.10 Final
    4. Spring ORM Version 3.2.0
    5. MySQL version 5
    6. Maven 3

First let us setup the development environment. Download this document and follow the step by step instruction to install the necessary software’s.

Part 1: This post explain how to create ZK Maven project in eclipse IDE as step by step.
Part 2: This post talks about creating Domain, DAO and Service Layer.
Part 3: Spring Integration with Hibernate
Part 4: Presentation Layer
Part 5: Change the look and feel.
Part 6: Spring security 3 integration with hibernate 4
Part 7: More features such as Data filter, etc..
Part 8: ZK Theme customization for each user
Part 9: Bug Fixing Cycle :)
Part 10: jQuery integration with ZK Framework
Part 11: Store image in the database.
Part 12 : Validation using Hibernate Validator
Part 13 : More Validation using Hibernate Validator

You can download the source here.  and You can download the war file here 
If you are not able to download the source, please drop a email to

Well, You have learned the basics of ZK Framework and now you are ready to go to develop a Complete commercial Application or Sample Application. But how to start ? You might be end with lot of questions such as “Is there any template available ?”, “any support available for the project template”?, etc.

Here it is. I have developed a small Project start up kit with the following features

1. Menus are Dynamic for N Level support. What does it mean ? Well, in the modern Web application, you might want to visible/invisible Menu by each users type (aka Dynamic Menu). This template has that option . All the Menu caption and levels are Stored in MySQL Database and after login , it will retrieve the menus assigned only for the user.

2. Apart from Menu, You might be interested in giving permission to add/delete/edit for CRUD Based screens. Using this template, you can also control by each user.

3. For all the CRUD Based screens, Export to Excel option template is provided.

4. Sample CRUD Screen are Provided to ready to start.

5. Integrated with Spring Security

6. Integrated with Spring Hibernate Security.

7. Base DAO and DAO implementation classes are provided.

8. Utilising ZK's MVVM databinding.

9. Project comes with 5 different themes . So you can set theme by each user and after login, the selected theme will be applied.

Apart from the above, the Most important option is “ Support!!!!!!!”. Users who buying this kit, unlimited support will be provided to help them to understand the structure. If you are interested in buying this start up kit, please email to me at

Video Demo

Screen shots





  1. senthil you're Master, keep sharing the knowledge it will help you a lot.

  2. Replies
    1. Yes ofcourse. I have the link to download the source code in this same page.

  3. Dear Senthil,

    I can't shake your hand coz you kindly to share your knowledge bout Java Tech (Spring,ZK,Hiber,etc..) wwith detail.
    Thank you so much.

  4. Thank you for this awesome tutorial!

  5. Dear Senthil,
    Thanks very much. You are super.
    In African we say, I take off my cap/hat for you.(Respect)
    Thanks again

  6. Senthil,
    could you explain to me about the binding from zul to mvvm. to be honest, I still don't get it, specially in
    "div form=@id(fx) @load(vm.selectedRecord)
    how to bind selectedRecord? i try my new project with no luck.

    1. SelectedRecord Property is available in the VM ? Basically, this selectedRecord will be new object for new record and for edit/view, this will point to selected record from the List.
      For More information, please see here's_Reference/MVVM/Data_Binding/Form_Binding

  7. Thank you for this awesome tutorial!.Can we download this code.The link u mentioned above is not working.I want it urgently please.

    1. Thank you. Download is working. Please check again. If you have still problem, drop a mail to

  8. Hi Senthil,

    I am really highly surprised to see your quick response. And a ton of thanks for the code.

    Thanks & Regards,
    Keshav Raj

  9. Hi Senthil,

    Thanks you very much for your excellent technical support.It was looking for tool.jar . I changed JRE folder(now C:\Program Files\Java\jdk1.7.0_25\jre) and it worked.I have one more question, if i want to switch to latest hibernate and spring then how to find out another required jars.

    Thanks & Regrads,
    Keshav Raj

  10. Very good tutorials! Thank you very much

  11. Senthil, i'm getting memory error and tomcat is getting closed after clicking 'Add New' button. I downloaded the source code and created the war and deployed it. Please provide the fix for this.

  12. Do you have this kind of tutorial using no maven? Thanks

  13. Dear Senthil,
    Thanks for your tutorial, but download link is fail. Could you fix it?

    1. Please send your email id, let me send the same in email

  14. Dear Senthil,
    Thanks you very much for tutorial. I can't download this file. You can send mail to me.
    My email :
    Thanks & Regrads,

  15. Great tutorial. Thanks for posting it. But I am unable to download the sample code from the link given in this blog. Kindly let me know how can I download the code

  16. Hi Senthil,
    Great job! Thanks a lot for tutorial. But download link doesn't work.
    Can you share sources with me by email.
    My email is

    Thanks again!

  17. great job... thanks for tutorial

  18. Great tutorial!

    Did you have a war file of this source?

    My email is

    Thanks again!

  19. Dont sharing anything. Give us more source code and example again.

  20. The link is not active. Give me link active now.

  21. Leider nur ein paar sucht aurative Betrachtung. Menschen mit Unfruchtbarkeit würde tatsächlich das Gefühl mangelhaft und verlieren alle Sehnsucht nach Sex. Kamagra

  22. Hi Senthil
    I have be learning based in your codes and examples, and are learned a lot so far, but I'd like to ask if is it possible to create table(s) using hibernate based in spring, besides creating the database and its table(s) from MYSQL? if it is possible, can you please help me?


EDI 837 P Budget Number Example