{"id":296,"date":"2016-10-11T19:58:40","date_gmt":"2016-10-11T19:58:40","guid":{"rendered":"http:\/\/localhost\/blog\/?p=296"},"modified":"2018-11-27T10:36:50","modified_gmt":"2018-11-27T10:36:50","slug":"spring-mvc-hibernate-eclipse-maven","status":"publish","type":"post","link":"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/","title":{"rendered":"Spring MVC Configuration with Hibernate in Eclipse-maven-JQuery-JSON-CRUD"},"content":{"rendered":"<h1>Spring MVC Configuration with Hibernate in Eclipse-maven-JQuery-JSON-CRUD<\/h1>\n<p>Most of the people stuck when they are trying to configure Spring MVC\u00a0project first time and They don&#8217;t know\u00a0about Each of statement\u00a0or file. What is the\u00a0purpose of it and How\u00a0it works. I&#8217;ll try to\u00a0define each of thing in\u00a0this example<\/p>\n<p>For the Database table mapping with Java Object, I have used Hibernate which is the most famous Object Relational Mapping tool.<\/p>\n<p>In the most of projects an AJAX\u00a0call is used for web services\u00a0which returns JSON so we\u00a0will learn ajax in JQuery too.<\/p>\n<p>I have used many APIs in this project,\u00a0Instead of including each of individual API\u00a0in\u00a0project I have used Maven Software\u00a0Project Management tool for managing project APIs.<\/p>\n<hr \/>\n<h4>Package Explorer<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-306 size-full\" src=\"http:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/10\/project-structure.jpg\" alt=\"Spring MVC\" width=\"333\" height=\"524\" border=\"1\" srcset=\"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/10\/project-structure.jpg 333w, https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/10\/project-structure-191x300.jpg 191w\" sizes=\"auto, (max-width: 333px) 100vw, 333px\" \/><br \/>\nHere in Package Explorer, the Project Structure of Spring MVC \u00a0is shown each of section is expanded to see each of file with file extension.<\/p>\n<hr \/>\n<h4>FILE: SpringMVC\/pom.xml<\/h4>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;project xmlns=&quot;http:\/\/maven.apache.org\/POM\/4.0.0&quot; xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;\r\n  xsi:schemaLocation=&quot;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/maven-v4_0_0.xsd&quot;&gt;\r\n  &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n  &lt;groupId&gt;com.spring&lt;\/groupId&gt;\r\n  &lt;artifactId&gt;SpringMVC&lt;\/artifactId&gt;\r\n  &lt;packaging&gt;war&lt;\/packaging&gt;\r\n  &lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n  &lt;name&gt;SpringMVC Maven Webapp&lt;\/name&gt;\r\n  &lt;url&gt;http:\/\/maven.apache.org&lt;\/url&gt;\r\n  \r\n  &lt;properties&gt;\r\n    &lt;java-version&gt;1.7&lt;\/java-version&gt;\r\n    &lt;org.springframework-version&gt;4.2.6.RELEASE&lt;\/org.springframework-version&gt;\r\n &lt;\/properties&gt;\r\n \r\n  &lt;dependencies&gt;\r\n    &lt;dependency&gt;\r\n      &lt;groupId&gt;junit&lt;\/groupId&gt;\r\n      &lt;artifactId&gt;junit&lt;\/artifactId&gt;\r\n      &lt;version&gt;3.8.1&lt;\/version&gt;\r\n      &lt;scope&gt;test&lt;\/scope&gt;\r\n    &lt;\/dependency&gt;\r\n        \r\n    &lt;dependency&gt;\r\n\t\t&lt;groupId&gt;javax.servlet&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;javax.servlet-api&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;3.1.0&lt;\/version&gt;\r\n\t&lt;\/dependency&gt;\r\n    \r\n    &lt;dependency&gt;\r\n\t&lt;groupId&gt;javax.servlet&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;jstl&lt;\/artifactId&gt;\r\n\t&lt;version&gt;1.2&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;!--  --&gt;\r\n\r\n&lt;!-- http:\/\/mvnrepository.com\/artifact\/org.springframework\/spring-context-support --&gt;\r\n&lt;dependency&gt;\r\n    &lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;spring-context-support&lt;\/artifactId&gt;\r\n    &lt;version&gt;4.2.6.RELEASE&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;spring-webmvc&lt;\/artifactId&gt;\r\n\t&lt;version&gt;4.2.6.RELEASE&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;spring-orm&lt;\/artifactId&gt;\r\n\t&lt;version&gt;4.2.6.RELEASE&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;spring-tx&lt;\/artifactId&gt;\r\n\t&lt;version&gt;4.2.6.RELEASE&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.springframework&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;spring-web&lt;\/artifactId&gt;\r\n\t&lt;version&gt;4.2.6.RELEASE&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;commons-dbcp&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;commons-dbcp&lt;\/artifactId&gt;\r\n\t&lt;version&gt;1.4&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;!-- MySQL Server Libraries --&gt;\r\n&lt;!-- &lt;dependency&gt;\r\n\t&lt;groupId&gt;mysql&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;mysql-connector-java&lt;\/artifactId&gt;\r\n\t&lt;version&gt;5.1.36&lt;\/version&gt;\r\n&lt;\/dependency&gt; --&gt;\r\n\r\n&lt;!-- SQL Server 2012 and 2014 Libraries --&gt;\r\n&lt;dependency&gt;\r\n     &lt;groupId&gt;com.microsoft.sqlserver&lt;\/groupId&gt;\r\n     &lt;artifactId&gt;sqljdbc4&lt;\/artifactId&gt;\r\n     &lt;version&gt;3.0&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.codehaus.jackson&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;jackson-mapper-asl&lt;\/artifactId&gt;\r\n\t&lt;version&gt;1.9.10&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;com.google.code.gson&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;gson&lt;\/artifactId&gt;\r\n\t&lt;version&gt;2.3&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n\t&lt;groupId&gt;org.hibernate&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;hibernate-core&lt;\/artifactId&gt;\r\n\t&lt;version&gt;4.1.0.Final&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n\r\n\r\n\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.hibernate.javax.persistence&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;hibernate-jpa-2.0-api&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;1.0.0.Final&lt;\/version&gt;\r\n\t&lt;\/dependency&gt;\r\n\r\n&lt;dependency&gt;\r\n    &lt;groupId&gt;net.sf.jasperreports&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;jasperreports&lt;\/artifactId&gt;\r\n    &lt;version&gt;6.4.0&lt;\/version&gt;\r\n&lt;\/dependency&gt;\r\n    \r\n    \r\n  &lt;\/dependencies&gt;\r\n  &lt;build&gt;\r\n    &lt;finalName&gt;SpringMVC&lt;\/finalName&gt;\r\n  &lt;\/build&gt;\r\n&lt;\/project&gt;\r\n<\/pre>\n<h2>Why we use pom.xml file in spring mvc<\/h2>\n<p><strong>POM<\/strong> stands for &#8220;Project Object Model&#8221;, This is a file which contain all Maven Configuration for building a project.<\/p>\n<ul>\n<li><strong>&lt;project&gt;<\/strong> element is the root element of this POM file. There are following possible children of this element with short description.<\/li>\n<li><strong>&lt;<tt>modelVersion<\/tt> &gt;<\/strong> 4.0.0 is a child element of &lt;project&gt;. It is currently describing the support for Maven 2 and Maven 3 versions.<\/li>\n<li><strong>&lt;groupId&gt;\u00a0<\/strong>is a child element of &lt;project&gt;. It is universally unique identifier for project, as a normal to use fully qualified package name to distinguish similar project names<\/li>\n<li><strong>&lt;artifactId&gt;\u00a0<\/strong>is a child element of &lt;project&gt;. It is a unique identifier within group by the group Id. Artifact Id is produced by Maven for project include JARs, Wars etc.<\/li>\n<li><strong>&lt;packaging&gt;\u00a0<\/strong>is a child element of &lt;project&gt;. If you are running a command &#8220;maven clean install&#8221; It&#8217;ll generate .war file with artifactId. There is in this project we have a name of ArtifactId is SpringMVC so our generated file will be SpringMVC.war in target direct of project.<\/li>\n<li><strong>&lt;version&gt;\u00a0<\/strong>is a child element of &lt;project&gt;. It is a version number of current project.<\/li>\n<li><strong>&lt;name&gt;\u00a0<\/strong>is a child element of &lt;proect&gt;. It is a full name of Project.<\/li>\n<li><strong>&lt;url&gt;\u00a0<\/strong>is a child element of &lt;project&gt;. It is a project&#8217;s home page URL.<\/li>\n<li><strong>&lt;properties&gt;\u00a0<\/strong>is a child element of &lt;project&gt;. The various plugins use these project properties.<\/li>\n<li><strong>&lt;java-version&gt;\u00a0<\/strong>is a child element of &lt;properties&gt;. The Java version for plugin use<\/li>\n<li><strong>&lt;org.springframework-version&gt;\u00a0<\/strong>is a child element of &lt;properties&gt;. The Spring frame work version for plugin use.<\/li>\n<li><strong>&lt;dependencies&gt;\u00a0<\/strong>is a child element of &lt;project&gt;. This element describes all\u00a0dependencies associated with a project. They are automatically downloaded from repositories for this project.<\/li>\n<li><strong>&lt;dependency&gt;\u00a0<\/strong>is a child element of &lt;project&gt;. It is a element for downloading and installing dependency.<\/li>\n<li><strong>&lt;groupId&gt;\u00a0<\/strong>is a child element of &lt;dependency&gt;. It is a unique identifier for \u00a0project group, which is produced for dependency.<\/li>\n<li><strong>&lt;artifactId&gt; <\/strong>is a child element of &lt;dependency&gt;. It is a unique identifier for artifact.<\/li>\n<li><strong>&lt;version&gt;\u00a0<\/strong>is a child element of &lt;dependency&gt;. It is a version of dependency.<\/li>\n<\/ul>\n<hr \/>\n<h4>FILE:\u00a0\/SpringMVC\/src\/main\/webapp\/index.jsp<\/h4>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;html&gt;\r\n&lt;body&gt;\r\n&lt;h2&gt;Hello World!&lt;\/h2&gt;\r\n&lt;p&gt;List of URLs for Available Demos&lt;\/p&gt;\r\n&lt;ul&gt;\r\n\t&lt;li&gt;&lt;a href=&quot;http:\/\/localhost:8080\/SpringMVC\/users\/page&quot;&gt; Users CRUD Operations &lt;\/a&gt;&lt;\/li&gt;\r\n&lt;\/ul&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>It is an Index file, which is displayed first and contains Users CURD page URL<\/p>\n<hr \/>\n<h4>FILE:\u00a0\/SpringMVC\/src\/main\/webapp\/WEB-INF\/applicationContext.xml<\/h4>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\r\n&lt;beans xmlns=&quot;http:\/\/www.springframework.org\/schema\/beans&quot;\r\n\txmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; \r\n\txmlns:tx=&quot;http:\/\/www.springframework.org\/schema\/tx&quot;\r\n\txmlns:mvc=&quot;http:\/\/www.springframework.org\/schema\/mvc&quot; \r\n\txmlns:context=&quot;http:\/\/www.springframework.org\/schema\/context&quot;\r\n\txsi:schemaLocation=&quot;http:\/\/www.springframework.org\/schema\/beans\r\nhttp:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd\r\nhttp:\/\/www.springframework.org\/schema\/tx\r\nhttp:\/\/www.springframework.org\/schema\/tx\/spring-tx-3.0.xsd\r\nhttp:\/\/www.springframework.org\/schema\/context\r\nhttp:\/\/www.springframework.org\/schema\/context\/spring-context-3.0.xsd\r\nhttp:\/\/www.springframework.org\/schema\/mvc\r\nhttp:\/\/www.springframework.org\/schema\/mvc\/spring-mvc-3.0.xsd&quot;&gt;\r\n\r\n&lt;!-- Enable autowire --&gt;\r\n\t&lt;context:annotation-config \/&gt;\r\n \t&lt;context:component-scan base-package=&quot;com&quot; \/&gt;\r\n \t\r\n\t&lt;mvc:annotation-driven \/&gt; \r\n\t\r\n\t&lt;mvc:resources mapping=&quot;\/resources\/**&quot; location=&quot;\/resources\/&quot; \/&gt;\r\n\t\r\n\t&lt;!-- If you use MySQL Database comment out this bean and let others commented  --&gt;\r\n    &lt;!-- &lt;bean id=&quot;dataSource&quot; class=&quot;org.apache.commons.dbcp.BasicDataSource&quot;&gt;\r\n\t\t&lt;property name=&quot;driverClassName&quot; value=&quot;com.mysql.jdbc.Driver&quot; \/&gt;\r\n\t\t&lt;property name=&quot;url&quot; value=&quot;jdbc:mysql:\/\/127.0.0.1:3306\/tests&quot; \/&gt;\r\n\t\t&lt;property name=&quot;username&quot; value=&quot;root&quot; \/&gt;\r\n\t\t&lt;property name=&quot;password&quot; value=&quot;root&quot; \/&gt;\r\n\t&lt;\/bean&gt; --&gt;\r\n\t\r\n\t&lt;!-- SQL Server 2012 and 2014 Database drivers and connectivity code --&gt;\r\n\t&lt;bean id=&quot;dataSource&quot; class=&quot;org.apache.commons.dbcp.BasicDataSource&quot;&gt;\r\n\t\t&lt;property name=&quot;driverClassName&quot; value=&quot;com.microsoft.sqlserver.jdbc.SQLServerDriver&quot; \/&gt;\r\n\t\t&lt;property name=&quot;url&quot; value=&quot;jdbc:sqlserver:\/\/localhost;databaseName=mydb&quot; \/&gt;\r\n\t\t&lt;property name=&quot;username&quot; value=&quot;sa&quot; \/&gt;\r\n\t\t&lt;property name=&quot;password&quot; value=&quot;abcd@1234&quot; \/&gt;\r\n\t&lt;\/bean&gt;\r\n\r\n\t&lt;!-- Session Factory Declaration --&gt;\r\n\t&lt;bean id=&quot;sessionFactory&quot;\r\n\t\tclass=&quot;org.springframework.orm.hibernate4.LocalSessionFactoryBean&quot;&gt;\r\n\t\t&lt;property name=&quot;dataSource&quot; ref=&quot;dataSource&quot; \/&gt;\r\n\t\t&lt;property name=&quot;packagesToScan&quot; value=&quot;com.entities&quot; \/&gt;\r\n\t\t&lt;property name=&quot;hibernateProperties&quot;&gt;\r\n\t\t\t&lt;props&gt;\r\n\t\t\t\t&lt;!-- SQL Dialect --&gt;\r\n\t\t\t\t&lt;!-- &lt;prop key=&quot;hibernate.dialect&quot;&gt;org.hibernate.dialect.MySQLDialect&lt;\/prop&gt; --&gt;\r\n\t\t\t\t\r\n\t\t\t\t&lt;!-- SQL Server 2014 Dialect --&gt;\r\n\t\t\t\t&lt;prop key=&quot;hibernate.dialect&quot;&gt;org.hibernate.dialect.MySQLDialect&lt;\/prop&gt;\r\n\t\t\t\t\r\n\t\t\t\t&lt;!-- Your required Database Name --&gt;\r\n\t\t\t\t&lt;prop key=&quot;hibernate.default_schema&quot;&gt;dbo&lt;\/prop&gt;\r\n\t\t\t\t\r\n\t\t\t\t&lt;prop key=&quot;hibernate.show_sql&quot;&gt;true&lt;\/prop&gt;\r\n\t\t\t\t&lt;prop key=&quot;hibernate.enable_lazy_load_no_trans&quot;&gt;true&lt;\/prop&gt;\r\n\t\t\t\t&lt;prop key=&quot;format_sql&quot;&gt;true&lt;\/prop&gt;\r\n\t\t\t\t&lt;prop key=&quot;use_sql_comments&quot;&gt;true&lt;\/prop&gt;\r\n\t\t\t&lt;\/props&gt;\r\n\t\t&lt;\/property&gt;\r\n\t&lt;\/bean&gt;\r\n\r\n\t&lt;tx:annotation-driven transaction-manager=&quot;transactionManager&quot; \/&gt;\r\n\t\r\n\t &lt;bean id=&quot;transactionManager&quot;\r\n        class=&quot;org.springframework.orm.hibernate4.HibernateTransactionManager&quot;&gt;\r\n        &lt;property name=&quot;sessionFactory&quot; ref=&quot;sessionFactory&quot; \/&gt;\r\n    &lt;\/bean&gt;\r\n    \r\n    \r\n\r\n&lt;\/beans&gt;\r\n<\/pre>\n<h2>Why we use application contenxt file in spring mvc?<\/h2>\n<p>This fie is used when Spring configuration is provided to Application by application context file. It defines beans at root webapp context.<\/p>\n<ul>\n<li>By <strong>&lt;context:annotation-config\/&gt; <\/strong> element, we tells application to activate beans already registered in application context. It gives general support for annotation Like @Required, @Autowired, @PostConstructor<\/li>\n<li>By <strong>&lt;context:component-scan base-package=&#8221;com&#8221;\/&gt; <\/strong> element, we tells application to activate beans already registered in application context and scan package to find, register beans in application context.<\/li>\n<li>By <strong>&lt; mvc:annotation-driven \/&gt; <\/strong> element, we gives application to support for annotation-driven MVC Controllers Like @RequestMapping, @Controller, @RequestBody, @ResponseBody<\/li>\n<li>By <strong>&lt; mvc:resources mapping=&#8221;\/resources\/**&#8221; location=&#8221;\/resources\/&#8221; \/&gt; <\/strong> element,<\/li>\n<li><strong> &lt;mvc:annotation-driven \/&gt; <\/strong> is to tell that you can define spring beans dependencies without defining much elements in xml or implements interface or extends a class.<\/li>\n<li><strong>@Repository<\/strong> is to tell that Class is a Dao without having to extend JpaDaoSupport or SubClass DaoSupport.<\/li>\n<li><strong>@Controller<\/strong> is to tell that Class having all methods to handle HTTP request without implements Controller interface or extends Sub class of Controllers.<\/li>\n<li><strong>&lt;context:component-scan base-package=&#8221;com&#8221; \/&gt;<\/strong> is to tell that your spring application will search base package for scanning classes with @Controller, @Services, @Repository, or @Component<\/li>\n<li><strong>&lt;mvc:resources mapping=&#8221;\/resources\/**&#8221; location=&#8221;\/resources\/&#8221; \/&gt; <\/strong> is tell that spring application needs to define path location and mapping to static resources like CSS, Images or JavaScripts.<\/li>\n<li><strong>&lt;bean&gt;<\/strong> is a java bean. Java Bean is a simple class with private fields and setter, getter methods. In XML we can defined it for usage. So here in this file three of beans tags are used with properties. Each property is like Class Private Field.<\/li>\n<li><strong>DataSource Bean: <\/strong> There are two attribute defined in this bean.\n<ul>\n<li><strong>ID<\/strong> is defined for Unique Identifier for this bean as \u201cdataSource\u201d<\/li>\n<li><strong>CLASS<\/strong> is defined for reference type of \u201corg.apache.commons.dbcp.BasicDataSource\u201d.<\/li>\n<\/ul>\n<\/li>\n<li><strong>BasicDataSource <\/strong> of Apache Commos is used for interaction with Relational Database. It helps for creating a new connection for an application.<\/li>\n<li>Properties of BasicDataSource class:\n<ul>\n<li><strong>driverClassName: <\/strong> The JDBC Driver Class Name to be used.<\/li>\n<li><strong>url: <\/strong> The connection URL to be passed to JDBC driver to establish a connection.<\/li>\n<li><strong>username:<\/strong> The connection username to be passed to JDBC driver to establish a connection.<\/li>\n<li><strong>password:<\/strong> The connection password to be passed to JDBC driver to establish a connection.<\/li>\n<\/ul>\n<\/li>\n<li><strong> SessionFactory Bean: <\/strong> There are two attribute defined in this bean.\n<ul>\n<li><strong> ID <\/strong> Is defined for Unique Identifier for this bean as \u201csessionFactory\u201d<\/li>\n<li><strong> CLASS <\/strong> is defined for reference type of \u201corg.springframework.orm.hibernate4.LocalSessionFactoryBean\u201d.<\/li>\n<\/ul>\n<\/li>\n<li>Properties of LocalSessionFactoryBean class:\n<ul>\n<li><strong>dataSource: <\/strong> SessionFactory uses dataSource properties. There is ref a attribute for referring bean by its ID.<\/li>\n<li><strong>packagesToScan:<\/strong> To specify packages to search for auto detection of entity classes in the classpath.<\/li>\n<li><strong>hibernateProperties : <\/strong> It sets hibernate properties.<\/li>\n<li><strong> hibernate.dialect: <\/strong> To specify correct database Dialect. Each Database has different SQL code generator.<\/li>\n<li><strong>hibernate.show_sql:<\/strong> Write all SQL statements to CONSOLE<\/li>\n<li><strong>hibernate.default_schema:<\/strong> Qualifies unqualified Table names with Given Table Name and Schema Name.<\/li>\n<li><strong>format_sql:<\/strong> Pretty print the SQL in Console and LOG.<\/li>\n<li><strong>use_sql_comments: <\/strong> Hibernate will generate Comments inside SQL.<\/li>\n<\/ul>\n<\/li>\n<li><strong>TransactionManager Bean: <\/strong> There are two attribute defined in this bean.\n<ul>\n<li><strong>ID<\/strong> Is defined for Unique Identifier for this bean as \u201ctransactionManager\u201d<\/li>\n<li><strong>CLASS<\/strong> is defined for reference type of \u201corg.springframework.orm.hibernate4.HibernateTransactionManager\u201d.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Properties of HibernateTransactionManager Class: <\/strong><br \/>\nThis transaction manager is appropriate for applications that use a single Hibernate SessionFactory for transaction data access<\/li>\n<\/ul>\n<hr \/>\n<h4>FILE:\/SpringMVC\/src\/main\/webapp\/WEB-INF\/SpringMVC-servlet.xml<\/h4>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\"> &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\r\n&lt;beans xmlns=&quot;http:\/\/www.springframework.org\/schema\/beans&quot;\r\n   xmlns:context=&quot;http:\/\/www.springframework.org\/schema\/context&quot;\r\n   xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;\r\n   xsi:schemaLocation=&quot;\r\n   http:\/\/www.springframework.org\/schema\/beans     \r\n   http:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd\r\n   http:\/\/www.springframework.org\/schema\/context \r\n   http:\/\/www.springframework.org\/schema\/context\/spring-context-3.0.xsd&quot;&gt;\r\n\r\n   &lt;bean class=&quot;org.springframework.web.servlet.view.InternalResourceViewResolver&quot;&gt;\r\n      &lt;property name=&quot;prefix&quot; value=&quot;\/WEB-INF\/views\/&quot; \/&gt;\r\n      &lt;property name=&quot;suffix&quot; value=&quot;.jsp&quot; \/&gt;\r\n   &lt;\/bean&gt;\r\n \r\n&lt;\/beans&gt; <\/pre>\n<ul>\n<li><strong>ServletContext.xml: <\/strong> It is a servlet level configuration file. Each application context can have multiple servlet context files. It holds all the configurations for the whole servlet application.<\/li>\n<li><strong>InternalResourceViewResolver Bean:<\/strong> By this resolver, we tell the servlet application about path of JSP views under the WEB-INF. Controllers always access them. It takes prefix for the name path and suffix for the file name.<\/li>\n<\/ul>\n<hr \/>\n<h4>FILE:\/SpringMVC\/src\/main\/webapp\/WEB-INF\/web.xml<\/h4>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;web-app id=&quot;WebApp_ID&quot; version=&quot;2.4&quot; \r\n\txmlns=&quot;http:\/\/java.sun.com\/xml\/ns\/j2ee&quot; \r\n\txmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; \r\n\txsi:schemaLocation=&quot;http:\/\/java.sun.com\/xml\/ns\/j2ee \r\n\thttp:\/\/java.sun.com\/xml\/ns\/j2ee\/web-app_2_4.xsd&quot;&gt;\r\n\t\r\n  &lt;display-name&gt;Archetype Created Web Application&lt;\/display-name&gt;\r\n\t\r\n\t&lt;context-param&gt;\r\n\t  \t&lt;param-name&gt;ApplicationContext&lt;\/param-name&gt;\r\n\t  \t&lt;param-value&gt;\/WEB-INF\/applicationContext.xml&lt;\/param-value&gt;\r\n\t &lt;\/context-param&gt;\r\n\r\n  \t&lt;servlet&gt;\r\n        &lt;servlet-name&gt;SpringMVC&lt;\/servlet-name&gt;\r\n        &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;\/servlet-class&gt;\r\n        &lt;load-on-startup&gt;1&lt;\/load-on-startup&gt;\r\n    &lt;\/servlet&gt;\r\n\r\n    &lt;servlet-mapping&gt;\r\n        &lt;servlet-name&gt;SpringMVC&lt;\/servlet-name&gt;\r\n        &lt;url-pattern&gt;\/&lt;\/url-pattern&gt;\r\n    &lt;\/servlet-mapping&gt;\r\n    \r\n    &lt;listener&gt;\r\n    &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;\/listener-class&gt;\r\n\t&lt;\/listener&gt;\r\n\t\r\n\t&lt;listener&gt;\r\n\t\t&lt;listener-class&gt;org.springframework.web.context.request.RequestContextListener&lt;\/listener-class&gt;\r\n\t&lt;\/listener&gt;\r\n\t\r\n&lt;\/web-app&gt;\r\n<\/pre>\n<ul>\n<li><strong>WEB.xml : <\/strong> It is a configuration file for web application in java. It instructs the servlet container <strong>(Tomcat) <\/strong> which class to load.\n<ul>\n<li>Filters could be defined in it.<\/li>\n<li>Welcome file list could be defined in it.<\/li>\n<li>Error pages could be defined in it.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Init-param: <\/strong> It is a static parameter, which is defined within servlet tag.It is a servlet level scope. At the servlet level you can get value of this.<\/li>\n<li><strong>Context-param:<\/strong> It is a static parameter, which is defined in web.xml file. It is an application level scope parameter. If the data does not change frequently you can store in it.<\/li>\n<li><strong>Servlet:<\/strong> The servlet element contains the declarative data of a servlet.<\/li>\n<li><strong>Servlet-Mapping:<\/strong> The servlet-mapping element defines a mapping between a servlet and a URL pattern.<\/li>\n<li><strong>Listener:<\/strong> The Listener element defines an event of the web application.<\/li>\n<\/ul>\n<hr \/>\n<h4>FILE:\/SpringMVC\/src\/main\/webapp\/WEB-INF\/views\/users.jsp<\/h4>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;%@ page language=&quot;java&quot; contentType=&quot;text\/html; charset=ISO-8859-1&quot;\r\n    pageEncoding=&quot;ISO-8859-1&quot;%&gt;\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n\r\n&lt;head&gt;\r\n&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=ISO-8859-1&quot;&gt;\r\n&lt;title&gt;Users&lt;\/title&gt;\r\n&lt;script src=&quot;https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.12.2\/jquery.min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body onload=&quot;load();&quot;&gt;\r\n\r\n\t\t&lt;input type=&quot;hidden&quot; id=&quot;user_id&quot;&gt;\r\n\t\tName: &lt;input type=&quot;text&quot; id=&quot;name&quot; required=&quot;required&quot; name=&quot;user_name&quot;&gt;&lt;br&gt;\r\n\t\tEmail: &lt;input type=&quot;email&quot; id=&quot;email&quot; required=&quot;required&quot; name=&quot;email&quot;&gt;&lt;br&gt;\r\n\t\t&lt;button onclick=&quot;submit();&quot;&gt;Submit&lt;\/button&gt;\r\n\t\r\n\t\r\n\r\n\t\t&lt;table id=&quot;table&quot; border=1&gt;\r\n\t\t\t&lt;tr&gt; &lt;th&gt; Name &lt;\/th&gt; &lt;th&gt; Email &lt;\/th&gt; &lt;th&gt; Edit &lt;\/th&gt; &lt;th&gt; Delete &lt;\/th&gt; &lt;\/tr&gt;\r\n\t\t\r\n\t\t&lt;\/table&gt;\r\n\t\t\t\r\n\t\r\n\t&lt;script type=&quot;text\/javascript&quot;&gt;\r\n\tdata = &quot;&quot;;\r\n\tsubmit = function(){\r\n\t\t \r\n\t\t\t$.ajax({\r\n\t\t\t\turl:'saveOrUpdate',\r\n\t\t\t\ttype:'POST',\r\n\t\t\t\tdata:{user_id:$(&quot;#user_id&quot;).val(),user_name:$('#name').val(),email:$('#email').val()},\r\n\t\t\t\tsuccess: function(response){\r\n\t\t\t\t\t\talert(response.message);\r\n\t\t\t\t\t\tload();\t\t\r\n\t\t\t\t}\t\t\t\t\r\n\t\t\t});\t\t\t\r\n\t}\r\n\t\r\n\tdelete_ = function(id){\t\t \r\n\t\t $.ajax({\r\n\t\t\turl:'delete',\r\n\t\t\ttype:'POST',\r\n\t\t\tdata:{user_id:id},\r\n\t\t\tsuccess: function(response){\r\n\t\t\t\t\talert(response.message);\r\n\t\t\t\t\tload();\r\n\t\t\t}\t\t\t\t\r\n\t\t});\r\n}\r\n\t\r\n\r\n\tedit = function (index){\r\n\t\t$(&quot;#user_id&quot;).val(data&#x5B;index].user_id);\r\n\t\t$(&quot;#name&quot;).val(data&#x5B;index].user_name);\r\n\t\t$(&quot;#email&quot;).val(data&#x5B;index].email);\r\n\t\t\r\n\t}\r\n\t\r\n\t\r\n\tload = function(){\t\r\n\t\t$.ajax({\r\n\t\t\turl:'list',\r\n\t\t\ttype:'POST',\r\n\t\t\tsuccess: function(response){\r\n\t\t\t\t\tdata = response.data;\r\n\t\t\t\t\t$('.tr').remove();\r\n\t\t\t\t\tfor(i=0; i&lt;response.data.length; i++){\t\t\t\t\t\r\n\t\t\t\t\t\t$(&quot;#table&quot;).append(&quot;&lt;tr class='tr'&gt; &lt;td&gt; &quot;+response.data&#x5B;i].user_name+&quot; &lt;\/td&gt; &lt;td&gt; &quot;+response.data&#x5B;i].email+&quot; &lt;\/td&gt; &lt;td&gt; &lt;a href='#' onclick= edit(&quot;+i+&quot;);&gt; Edit &lt;\/a&gt;  &lt;\/td&gt; &lt;\/td&gt; &lt;td&gt; &lt;a href='#' onclick='delete_(&quot;+response.data&#x5B;i].user_id+&quot;);'&gt; Delete &lt;\/a&gt;  &lt;\/td&gt; &lt;\/tr&gt;&quot;);\r\n\t\t\t\t\t}\t\t\t\r\n\t\t\t}\t\t\t\t\r\n\t\t});\r\n\t\t\r\n\t}\r\n\t\t\r\n\t&lt;\/script&gt;\r\n\t\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<ul>\n<li><strong>Users.jsp <\/strong> is user-defined page. It is a view for CRUD operations. It contains the javascript functions.<\/li>\n<li><strong>Load Function: <\/strong> It loads the data from server sides to the table.<\/li>\n<li><strong>Submit Function: <\/strong> It adds new record or updated record.<\/li>\n<li><strong>Edit Function: <\/strong> It edit the data to fields.<\/li>\n<\/ul>\n<hr \/>\n<h4>FILE:\/SpringMVC\/src\/main\/java\/com\/controllers\/UsersController.java<\/h4>\n<h4>Package: com.controllers<\/h4>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage com.controllers;\r\n\r\nimport java.util.HashMap;\r\nimport java.util.List;\r\nimport java.util.Map;\r\n\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\nimport org.springframework.web.bind.annotation.ResponseBody;\r\nimport org.springframework.web.servlet.ModelAndView;\r\n\r\nimport com.entities.Users;\r\nimport com.servicesapi.UsersService;\r\n\r\n@Controller\r\n@RequestMapping(&quot;users&quot;)\r\npublic class UsersController {\r\n\t\r\n\t@Autowired\r\n\tUsersService userServices;\r\n\t\r\n\t@RequestMapping(value=&quot;\/page&quot;, method = RequestMethod.GET)\r\n\tpublic ModelAndView getPage(){\r\n\t\tModelAndView view =new ModelAndView(&quot;users&quot;);\r\n\t\treturn view;\r\n\t}\r\n\t\r\n\t@RequestMapping(value=&quot;\/saveOrUpdate&quot;, method=RequestMethod.POST)\r\n\tpublic @ResponseBody Map&lt;String,Object&gt; getSaved(Users users){\r\n\t\tMap&lt;String,Object&gt; map = new HashMap&lt;String,Object&gt;();\r\n\t\t\r\n\t\tif(userServices.saveOrUpdate(users)){\r\n\t\t\tmap.put(&quot;status&quot;,&quot;200&quot;);\r\n\t\t\tmap.put(&quot;message&quot;,&quot;Your record have been saved successfully&quot;);\r\n\t\t}\r\n\t\t\r\n\t\treturn map;\r\n\t}\r\n\t\r\n\t\r\n\t@RequestMapping(value=&quot;\/list&quot;, method=RequestMethod.POST)\r\n\tpublic @ResponseBody Map&lt;String,Object&gt; getAll(Users users){\r\n\t\tMap&lt;String,Object&gt; map = new HashMap&lt;String,Object&gt;();\r\n\t\r\n\t\t\tList&lt;Users&gt; list = userServices.list();\r\n\t\t\t\r\n\t\t\tif (list != null){\r\n\t\t\t\tmap.put(&quot;status&quot;,&quot;200&quot;);\r\n\t\t\t\tmap.put(&quot;message&quot;,&quot;Data found&quot;);\r\n\t\t\t\tmap.put(&quot;data&quot;, list);\r\n\t\t\t}else{\r\n\t\t\t\tmap.put(&quot;status&quot;,&quot;404&quot;);\r\n\t\t\t\tmap.put(&quot;message&quot;,&quot;Data not found&quot;);\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\r\n\t\treturn map;\r\n\t}\r\n\t\r\n\t\r\n\t@RequestMapping(value=&quot;\/delete&quot;, method=RequestMethod.POST)\r\n\tpublic @ResponseBody Map&lt;String,Object&gt; delete(Users users){\r\n\t\tMap&lt;String,Object&gt; map = new HashMap&lt;String,Object&gt;();\r\n\t\t\r\n\t\tif(userServices.delete(users)){\r\n\t\t\tmap.put(&quot;status&quot;,&quot;200&quot;);\r\n\t\t\tmap.put(&quot;message&quot;,&quot;Your record have been deleted successfully&quot;);\r\n\t\t}\r\n\t\t\r\n\t\treturn map;\r\n\t}\r\n}\r\n<\/pre>\n<p><strong>UsersController.java : <\/strong> This is a controller, which receives the http request each time for saveOrEdit record, delete record or retrieving list of records.<\/p>\n<hr \/>\n<h4>FILE:\/SpringMVC\/src\/main\/java\/com\/daoapi\/UsersDao .java<\/h4>\n<h4>Package: com.daoapi<\/h4>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage com.daoapi;\r\n\r\nimport java.util.List;\r\n\r\nimport com.entities.Users;\r\n\r\npublic interface UsersDao {\r\n\tpublic boolean saveOrUpdate(Users users);\r\n\tpublic List&lt;Users&gt; list();\r\n\tpublic boolean delete(Users users);\r\n}\r\n<\/pre>\n<p><strong>UsersDao: <\/strong> It is a service for Dao repository.<\/p>\n<hr \/>\n<h4>FILE:\/SpringMVC\/src\/main\/java\/com\/daoimpl\/UsersImpl .java<\/h4>\n<h4>Package: com.daoimpl<\/h4>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage com.daoimpl;\r\n\r\nimport java.util.List;\r\n\r\nimport org.hibernate.SessionFactory;\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Repository;\r\nimport org.springframework.transaction.annotation.Transactional;\r\nimport org.springframework.web.bind.annotation.ResponseBody;\r\n\r\nimport com.daoapi.UsersDao;\r\nimport com.entities.Users;\r\n\r\n\r\n@Repository\r\n@Transactional\r\npublic class UsersImpl implements UsersDao{\r\n\r\n\t@Autowired\r\n\tSessionFactory session;\r\n\t\r\n\tpublic boolean saveOrUpdate(Users users) {\r\n\t\t\/\/ TODO Auto-generated method stub\r\n\t\tsession.getCurrentSession().saveOrUpdate(users);\r\n\t\treturn true;\r\n\t}\r\n\r\n\tpublic List&lt;Users&gt; list() {\r\n\t\treturn session.getCurrentSession().createQuery(&quot;from Users&quot;).list();\r\n\t}\r\n\r\n\tpublic boolean delete(Users users) {\r\n\t\ttry{\r\n\t\t\tsession.getCurrentSession().delete(users);\r\n\t\t}catch(Exception ex){\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\treturn true;\r\n\t}\r\n\t\r\n\t\r\n}\r\n<\/pre>\n<p><strong>UsersDaoImpl: <\/strong> It is a implementation of UsersDao Repository.<\/p>\n<hr \/>\n<h4>FILE:\/SpringMVC\/src\/main\/java\/com\/entities\/Users.java<\/h4>\n<h4>Package: com.entities<\/h4>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage com.entities;\r\n\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.GeneratedValue;\r\nimport javax.persistence.GenerationType;\r\nimport javax.persistence.Id;\r\nimport javax.persistence.Table;\r\n\r\n@Entity\r\n@Table(name=&quot;users&quot;)\r\npublic class Users {\r\n\t@Id\r\n\t@GeneratedValue(strategy=GenerationType.AUTO)\r\n\t@Column(name=&quot;user_id&quot;)\r\n\tprivate Integer user_id;\r\n\t\r\n\t@Column(name=&quot;user_name&quot;)\r\n\tprivate String user_name;\r\n\t\r\n\t@Column(name=&quot;email&quot;)\r\n\tprivate String email;\r\n\t\r\n\tpublic Integer getUser_id() {\r\n\t\treturn user_id;\r\n\t}\r\n\tpublic void setUser_id(Integer user_id) {\r\n\t\tthis.user_id = user_id;\r\n\t}\r\n\tpublic String getUser_name() {\r\n\t\treturn user_name;\r\n\t}\r\n\tpublic void setUser_name(String user_name) {\r\n\t\tthis.user_name = user_name;\r\n\t}\r\n\tpublic String getEmail() {\r\n\t\treturn email;\r\n\t}\r\n\tpublic void setEmail(String email) {\r\n\t\tthis.email = email;\r\n\t}\r\n\t\r\n}\r\n<\/pre>\n<p><strong>Users.java:<\/strong> It is an entity class with setter and getter methods.<\/p>\n<hr \/>\n<h4>FILE:\/SpringMVC\/src\/main\/java\/com\/servicesapi\/UsersService.java<\/h4>\n<h4>Package: com.servicesapi<\/h4>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage com.servicesapi;\r\n\r\nimport java.util.List;\r\n\r\nimport com.entities.Users;\r\n\r\npublic interface UsersService {\r\n\tpublic boolean saveOrUpdate(Users users);\r\n\tpublic List&lt;Users&gt; list();\r\n\tpublic boolean delete(Users users);\r\n}\r\n<\/pre>\n<p><strong>UsersServices: <\/strong> It is a service for Users.<\/p>\n<hr \/>\n<h4>FILE:\/SpringMVC\/src\/main\/java\/com\/servicesimpl\/UsersServiceImpl .java<\/h4>\n<h4>Package: com.servicesimpl<\/h4>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage com.servicesimpl;\r\n\r\nimport java.util.List;\r\n\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Service;\r\n\r\nimport com.daoapi.UsersDao;\r\nimport com.entities.Users;\r\nimport com.servicesapi.UsersService;\r\n\r\n@Service\r\npublic class UsersServiceImpl implements UsersService{\r\n\r\n\t@Autowired\r\n\tUsersDao userDao;\r\n\t\r\n\tpublic boolean saveOrUpdate(Users users) {\r\n\t\treturn userDao.saveOrUpdate(users);\r\n\t}\r\n\r\n\tpublic List&lt;Users&gt; list() {\r\n\t\t\/\/ TODO Auto-generated method stub\r\n\t\treturn userDao.list();\r\n\t}\r\n\r\n\tpublic boolean delete(Users users) {\r\n\t\t\/\/ TODO Auto-generated method stub\r\n\t\treturn userDao.delete(users);\r\n\t}\t\r\n\t\r\n}\r\n<\/pre>\n<p><strong>UsersServicesImpl:<\/strong> It is a service implementation for Users.<\/p>\n<hr \/>\n<h4 style=\"text-align: center;\">If you want watch this tutorial in video, check this Tutorial in Video<\/h4>\n<figure style=\"width: 120px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/sindhitutorials.com\/videos\/spring\/spring-mvc-configuration-videos\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/img.youtube.com\/vi\/8Gq-fEsN80U\/default.jpg\" alt=\"Video Tutorials\" width=\"120\" height=\"90\" \/><\/a><figcaption class=\"wp-caption-text\">Video Tutorial<\/figcaption><\/figure>\n<hr \/>\n<h3><a href=\"https:\/\/github.com\/sadiqodho\/Spring-MVC-with-Hibernate-CRUD\" target=\"_blank\" rel=\"noopener\"><span style=\"color: #0000ff;\">Download Spring MVC Source Code<\/span><\/a><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>Spring MVC Configuration with Hibernate in Eclipse-maven-JQuery-JSON-CRUD Most of the people stuck when they are trying to configure Spring MVC\u00a0project&#8230; <\/p>\n","protected":false},"author":1,"featured_media":628,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[154,155],"tags":[123,124,125,122],"class_list":["post-296","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-spring","tag-java","tag-programming","tag-projects","tag-spring-mvc"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spring MVC Config with Hibernate in Eclipse-maven-JQuery-JSON-CRUD<\/title>\n<meta name=\"description\" content=\"A Practical example of Spring MVC with hibernate using maven , JSON, JQuery, Ajax, Eclipse.Easy and well define spring mvc configuration with ORM hibernate.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring MVC Config with Hibernate in Eclipse-maven-JQuery-JSON-CRUD\" \/>\n<meta property=\"og:description\" content=\"A Practical example of Spring MVC with hibernate using maven , JSON, JQuery, Ajax, Eclipse.Easy and well define spring mvc configuration with ORM hibernate.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/\" \/>\n<meta property=\"og:site_name\" content=\"SindhiTutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/sindhitutorials\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/sindhitutorials\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-10-11T19:58:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-11-27T10:36:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/10\/Spring-MVC-Hibernate-CRUD.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1044\" \/>\n\t<meta property=\"og:image:height\" content=\"510\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"sadiqodho\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SindhiTutorials\" \/>\n<meta name=\"twitter:site\" content=\"@SindhiTutorials\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"sadiqodho\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"21 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/\",\"url\":\"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/\",\"name\":\"Spring MVC Config with Hibernate in Eclipse-maven-JQuery-JSON-CRUD\",\"isPartOf\":{\"@id\":\"https:\/\/sindhitutorials.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/10\/Spring-MVC-Hibernate-CRUD.jpg\",\"datePublished\":\"2016-10-11T19:58:40+00:00\",\"dateModified\":\"2018-11-27T10:36:50+00:00\",\"author\":{\"@id\":\"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/0643c170d77d3d0db865c1e7f6f56169\"},\"description\":\"A Practical example of Spring MVC with hibernate using maven , JSON, JQuery, Ajax, Eclipse.Easy and well define spring mvc configuration with ORM hibernate.\",\"breadcrumb\":{\"@id\":\"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/#primaryimage\",\"url\":\"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/10\/Spring-MVC-Hibernate-CRUD.jpg\",\"contentUrl\":\"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/10\/Spring-MVC-Hibernate-CRUD.jpg\",\"width\":1044,\"height\":510,\"caption\":\"Spring MVC Hibernate CRUD\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/sindhitutorials.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spring MVC Configuration with Hibernate in Eclipse-maven-JQuery-JSON-CRUD\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/#website\",\"url\":\"https:\/\/sindhitutorials.com\/blog\/\",\"name\":\"SindhiTutorials\",\"description\":\"A Platform for learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/sindhitutorials.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/0643c170d77d3d0db865c1e7f6f56169\",\"name\":\"sadiqodho\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c25afbd4104cdbe5c36d38acbb81619f?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c25afbd4104cdbe5c36d38acbb81619f?s=96&r=g\",\"caption\":\"sadiqodho\"},\"description\":\"I am passionate about teaching and learning\",\"sameAs\":[\"http:\/\/sindhitutorials.com\/\",\"https:\/\/www.facebook.com\/sindhitutorials\/\"],\"url\":\"https:\/\/sindhitutorials.com\/blog\/author\/sadiqodho\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring MVC Config with Hibernate in Eclipse-maven-JQuery-JSON-CRUD","description":"A Practical example of Spring MVC with hibernate using maven , JSON, JQuery, Ajax, Eclipse.Easy and well define spring mvc configuration with ORM hibernate.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/","og_locale":"en_US","og_type":"article","og_title":"Spring MVC Config with Hibernate in Eclipse-maven-JQuery-JSON-CRUD","og_description":"A Practical example of Spring MVC with hibernate using maven , JSON, JQuery, Ajax, Eclipse.Easy and well define spring mvc configuration with ORM hibernate.","og_url":"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/","og_site_name":"SindhiTutorials","article_publisher":"https:\/\/www.facebook.com\/sindhitutorials\/","article_author":"https:\/\/www.facebook.com\/sindhitutorials\/","article_published_time":"2016-10-11T19:58:40+00:00","article_modified_time":"2018-11-27T10:36:50+00:00","og_image":[{"width":1044,"height":510,"url":"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/10\/Spring-MVC-Hibernate-CRUD.jpg","type":"image\/jpeg"}],"author":"sadiqodho","twitter_card":"summary_large_image","twitter_creator":"@SindhiTutorials","twitter_site":"@SindhiTutorials","twitter_misc":{"Written by":"sadiqodho","Est. reading time":"21 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/","url":"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/","name":"Spring MVC Config with Hibernate in Eclipse-maven-JQuery-JSON-CRUD","isPartOf":{"@id":"https:\/\/sindhitutorials.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/#primaryimage"},"image":{"@id":"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/#primaryimage"},"thumbnailUrl":"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/10\/Spring-MVC-Hibernate-CRUD.jpg","datePublished":"2016-10-11T19:58:40+00:00","dateModified":"2018-11-27T10:36:50+00:00","author":{"@id":"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/0643c170d77d3d0db865c1e7f6f56169"},"description":"A Practical example of Spring MVC with hibernate using maven , JSON, JQuery, Ajax, Eclipse.Easy and well define spring mvc configuration with ORM hibernate.","breadcrumb":{"@id":"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/#primaryimage","url":"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/10\/Spring-MVC-Hibernate-CRUD.jpg","contentUrl":"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/10\/Spring-MVC-Hibernate-CRUD.jpg","width":1044,"height":510,"caption":"Spring MVC Hibernate CRUD"},{"@type":"BreadcrumbList","@id":"https:\/\/sindhitutorials.com\/blog\/spring-mvc-hibernate-eclipse-maven\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sindhitutorials.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Spring MVC Configuration with Hibernate in Eclipse-maven-JQuery-JSON-CRUD"}]},{"@type":"WebSite","@id":"https:\/\/sindhitutorials.com\/blog\/#website","url":"https:\/\/sindhitutorials.com\/blog\/","name":"SindhiTutorials","description":"A Platform for learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sindhitutorials.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/0643c170d77d3d0db865c1e7f6f56169","name":"sadiqodho","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c25afbd4104cdbe5c36d38acbb81619f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c25afbd4104cdbe5c36d38acbb81619f?s=96&r=g","caption":"sadiqodho"},"description":"I am passionate about teaching and learning","sameAs":["http:\/\/sindhitutorials.com\/","https:\/\/www.facebook.com\/sindhitutorials\/"],"url":"https:\/\/sindhitutorials.com\/blog\/author\/sadiqodho\/"}]}},"_links":{"self":[{"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/posts\/296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/comments?post=296"}],"version-history":[{"count":58,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/posts\/296\/revisions"}],"predecessor-version":[{"id":674,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/posts\/296\/revisions\/674"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/media\/628"}],"wp:attachment":[{"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/media?parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/categories?post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/tags?post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}