When I start the web application and open the page for inserting new Sport for a country, I choose a country and then i write for example basketball. Then I press submit and the exception is there. In db the sport ID is not NULL and I don't know where is the mistake. I've also found this http://blogs.warwick.ac.uk/colinyates/entry/i_hate_hibernate/ but I don't have such a mistake.
Thanks in advance!
Edited line length on the stack trace to prevent horizontal scroll bars. - Bill
Well things were looking pretty good until I got to your JSP
Rule #1 - Don't put any persistence/DB stuff in your JSP/view layer ever Rule #2 - Don't use scriptlets in your JSP
Your Spring controller looks pretty normal so we won't focus to much on that yet. You apparently have a service what is in there? You should also have a Repository (persistence layer) which is called by your service. This is where ALL of the data access stuff belongs (not in your jsp). Hibernate can be used to retrieve all your objects too. this list of objects can than be added to your model and displayed in your option select.
All of your db configuration user name password etc belongs in your Spring config.
I think I would try a tutorial project. As far as I can see the blog you listed is not really relevant to your problem.
Try this tutorial: Note this one is a little over simplified in that the hibernate stuff really should be in the persistence layer but it gives you an idea for the controller to JSP part.
It looks like you are on the right track. I would use the @Repository on your DAO for the reason I mentioned in the second link I provided. Also In you DAO don't use hibernateTemplate unless you have opted to use a very old version of hibernate (not recommended). With newer versions this is no longer considered to be the best practice instead follow the examples in the links I provided.
I would also use the newest version of Spring as many things are improved as time goes on. Currently that is 3.1.2-RELEASE
About the persistence/DB stuff in my JSP. Unfortunately, I didn't know if there exists another way to populate my drop down box. I found this on the web.
That web page should be purged from the Internet!
Once again read through the tutorial I linked and the post I made in that other thread. Implement what you learn from it and post back here or in our Spring forums with any specific problems you might encounter.
subject: Hibernate: could not set a field value by reflection setter