I hope you have visited my part1 of my tutorial. Let’s see the steps for integrating hibernate framework into Spring MVC. Here I have used MySQL database. I have created one database called “springmvc” and created one table called “user” with userid, username, password fields.
I have inserted some records into table like this.
Step 1: Creating User POJO class.
We need to create a User POJO class for mapping user table. Ok let’s create it.
Step 2: Creating hibernate mapping xml file for user class.
In hibernate we need to create hibernate mapping xml file for all domain class for mapping into corresponding database table. Instead of creating xml file you can use annotation for mapping domain class into database table. This is my mapping xml document created for mapping our user domain class into user database table.
Step 3: Creating authenticate service class.
The method “verifyUserNameAndPassword” present in “AuthenticateService” class is used for verifying the user name and password details against database table. It simply returns the boolean value.
Very important one is, I am injecting object for “HibernateTemplate” via setter method. So It’s time for defining data source bean, hibernate properties bean, session factory bean , hibernate template bean and our service beans into applicationContext.xml file.
Step 4: Modifying applicationContext.xml.
Here I have configured the beans that are related to hibernate as well as for our service class. Now we need to inject our service class into our controller and we need to call the “verifyUserNameAndPassword” method for verifying user credentials. So let’s see the steps for injecting our authenticate service class into login controller.
Step 5: Modifying Login Controller.
Here @Autowird annotation is used for injecting our service class into our controller.
That’s all. We have completed our development. Let’s do testing. I have deployed this application into apache server. The result of the application is,
Comments
LoginApp-SpringMVC-Part2 on github is not available
Refer the below link,
https://github.com/gnanasuriyan/Spring-Hibernate-MVC-Part2/tree/master/LoginApp-SpringMVC-Part2
Gnanasuriyan
when i am running u r application , after enter user name and password then hit submit button got this error.
please help me out..how can solve this error.
HTTP Status 404 - /WebApplication2/Login.spring/processCredentials
Any way very very thanks for the tutorial.
I will be very great full if you would refer any good book for me, with little description and more examples.
Everytime I use my username and password, it shows the invalid credentials. After hours of research I found out that HQL doesn't support the query alias and as soon as I removed the alias, my application started running fine.
Thanks again.
Wat could b the possible reason???
Pls help me
Thanks in advance
praveen
This is simple and the application authenticates user when user name and corresponding password is matching with database records. So you will have to insert to many users in user table.
thanks for the tutorial. it is simple and easy-to-understand.
Anjana
when i submit it will give me erroe message like
HTTP Status 404 - /LoginApp-SpringMVC-Part2/Login.spring/processCredentials
form action="Login.spring" method="post"
thank u
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:921)
at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:1)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
... 38 more
when ever i login its give me invalid credential
HTTP Status 404 - /LoginApp-SpringMVC-Part2/Login.spring/processCredentials
type Status report
message /LoginApp-SpringMVC-Part2/Login.spring/processCredentials
description The requested resource (/LoginApp-SpringMVC-Part2/Login.spring/processCredentials) is not available.
Please help us in resolving the error.
Thanks in advance.
please help me how i can resolve this
Selenium Training in Chennai
Selenium Training in Bangalore
java Training in Chennai
Java Training in Bangalore
data science certification
https://www.kitsonlinetrainings.com/course/sap-grc-online-training
http://kitsonlinetrainings.com/course/linux-onliane-trining
http://kitsonlinetrainings.com/course/windows-server-online-training
artificial intelligence course in pune
I was basically inspecting through the web filtering for certain data and ran over your blog. I am flabbergasted by the data that you have on this blog. It shows how well you welcome this subject. Bookmarked this page, will return for extra. data science course in jaipur
ServiceNow Training in Chennai
servicenow training and placement in hyderabad
Financial modeling course
Upgrade your skills with the Digital Marketing Courses in Delhi and start reading more about it. Digital Marketing Courses in Delhi
Great content and nice blog thanks for sharing this with us.
It is really very helpful, keep writing more such blogs.
Do read my blog too it will really help you with content writing.
we provide the Best Content Writing Courses in India.
Best Content Writing Courses in India
Digital Marketing Courses in Austria
What is Freelancing and How Does it work?
How to Become a Freelancer?
Is working as a Freelancer really a good Career?
What is a Freelancer Job Salary?
Can I live with a Self-Employed Home Loan?
What Kind of Freelancing Jobs are Skills are required?
How to get Freelance projects?
How Do companies hire Freelancers?
In our Blog, you will find a guide with Tips and Steps which will help you to take a good decision. Start reading and find out the Answers.
Digital marketing courses in Trivandrum