`
jilong-liang
  • 浏览: 480500 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类

SpringMVC+Hibernate全注解整合

阅读更多
package com.org.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.org.dao.UserDao;
import com.org.entity.User;
import com.org.service.UserService;

/**
 *@Author:liangjilong
 *@Date:2014-2-25
 *@Version:1.0
 *@Description:
 */
@Service
public class UserServiceImpl implements UserService{

	@Resource//@Autowired
	private  UserDao userDao;
	
	public List<User> getListUsers() {
		return userDao.getListUsers();
	}
	 
}

 

package com.org.action;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.org.entity.User;
import com.org.service.UserService;
import com.org.utils.servlet.ServletUtils;

/**
 *@Author:liangjilong
 *@Date:2014-2-25
 *@Version:1.0
 *@Description:
 */
@Controller
public class UserController{

	@Resource
	private UserService userService; 
	
	@RequestMapping(value="/userList1.do")
	public String geUserList1(HttpServletRequest request ,HttpServletResponse response) throws Exception {
		List<User> lists=userService.getListUsers();
		if(lists!=null){
			//request.setAttribute("userList", lists);
			ServletUtils.setRequestValue("userList", lists);
		}
		return "/user/userList";//user文件下的userList.jsp
	}

	
	@RequestMapping(value="/userList2.do")
	public ModelAndView geUserList2(HttpServletRequest request ,HttpServletResponse response) throws Exception {
		List<User> lists=userService.getListUsers();
		if(lists!=null){
			//request.setAttribute("userList", lists);
			ServletUtils.setRequestValue("userList", lists);
		}
		
		return new ModelAndView("/user/userList");
	}

}

 

package com.org.dao;

import java.util.List;

import com.org.entity.User;

/**
 *@Author:liangjilong
 *@Date:2014-2-25
 *@Version:1.0
 *@Description:
 */
public interface UserDao {

	public List<User> getListUsers();

}

 

package com.org.dao.impl;

import java.util.List;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import com.org.HibernateDaoImpl;
import com.org.dao.UserDao;
import com.org.entity.User;

/**
 *@Author:liangjilong
 *@Date:2014-2-25
 *@Version:1.0
 *@Description:
 */

@Repository//@Component
@SuppressWarnings("all")
public class UserDaoImpl extends HibernateDaoImpl implements UserDao {
 
	public List<User> getListUsers() {
		String hql="From User";
		//List<User>  lists=hibernateTemplate.find(hql);//方法一
		List<User>  lists=getHibernateTemplate().find(hql);//方法二
		return lists;
	}

}

 

package com.org.service;

import java.util.List;

import com.org.entity.User;

/**
 *@Author:liangjilong
 *@Date:2014-2-25
 *@Version:1.0
 *@Description:
 */
public interface UserService {
	public List<User> getListUsers();
 

}

 

package com.org;

import java.io.Serializable;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;

public class HibernateDaoImpl extends HibernateDaoSupport implements
		IHibernateDao {

	/**
	 * 这个和整合ibatis是一样的
	  */
	@Resource(name = "hibernateTemplate")
	protected HibernateTemplate hibernateTemplate;

	@PostConstruct
	public void initHibernateTemplate() {
		super.setHibernateTemplate(hibernateTemplate);
	}

	public Integer count(final String hql) {
		if (StringUtils.isEmpty(hql)) {
			throw new IllegalStateException("hql is null");
		}
		Object result = this.getHibernateTemplate().execute(
				new HibernateCallback<Object>() {
					public Object doInHibernate(Session session)
							throws HibernateException, SQLException {
						return session.createQuery(hql).uniqueResult();
					}
				});
		return ((Long) result).intValue();
	}

	public int bulkUpdate(String queryString, Object[] values) {
		return getHibernateTemplate().bulkUpdate(queryString, values);
	}

	public <E> void deleteAll(Collection<E> entities) {
		getHibernateTemplate().deleteAll(entities);
	}

	public Integer count(final String hql, final Object... obj) {
		if (ObjectUtils.isEmpty(obj)) {
			return count(hql);
		} else {
			if (StringUtils.isEmpty(hql)) {
				throw new IllegalStateException("hql is null");
			}
			Object result = this.getHibernateTemplate().execute(
					new HibernateCallback<Object>() {

						public Object doInHibernate(Session session)
								throws HibernateException, SQLException {
							Query query = session.createQuery(hql);
							for (int i = 0; i < obj.length; i++) {
								query.setParameter(i, obj[i]);
							}
							return query.uniqueResult();
						}
					});
			return ((Long) result).intValue();
		}
	}

	public <E> void delete(E entity) {
		getHibernateTemplate().delete(entity);
	}

	public <E> boolean exist(Class<E> c, Serializable id) {
		if (get(c, id) != null)
			return true;
		return false;
	}

	public <E> List<E> find(String queryString) {
		return getHibernateTemplate().find(queryString);
	}

	public <E> List<E> find(Class<E> bean) {
		String hql = "FROM " + bean.getSimpleName();
		return find(hql);
	}

	public List<?> find(String queryString, Object[] values) {
		if (ObjectUtils.isEmpty(values)) {
			return find(queryString);
		} else {
			return getHibernateTemplate().find(queryString, values);
		}
	}

	public <E> E findUniqueEntity(final String queryString,
			final Object... params) {
		if (StringUtils.isEmpty(queryString)) {
			throw new IllegalStateException("queryString is null");
		}
		if (ObjectUtils.isEmpty(params)) {
			return (E) getHibernateTemplate().execute(
					new HibernateCallback<Object>() {
						public Object doInHibernate(Session session) {
							return session.createQuery(queryString)
									.uniqueResult();
						}
					});
		} else {
			return (E) getHibernateTemplate().execute(
					new HibernateCallback<Object>() {
						public Object doInHibernate(Session session) {
							Query query = session.createQuery(queryString);

							for (int i = 0; i < params.length; i++) {
								query.setParameter(i, params[i]);
							}
							return query.uniqueResult();
						}
					});
		}
	}

	public <E> List<E> findByNamedQuery(String queryName) {
		if (StringUtils.isEmpty(queryName)) {
			throw new IllegalArgumentException("queryName is null");
		}
		return getHibernateTemplate().findByNamedQuery(queryName);
	}

	public <E> List<E> findByNamedQuery(String queryName, Object... values) {
		if (ObjectUtils.isEmpty(values)) {
			return this.findByNamedQuery(queryName);
		}
		return getHibernateTemplate().findByNamedQuery(queryName, values);
	}

	public <E> List<E> findByPage(final String hql, final Integer startRow,
			final Integer pageSize, final Object... params) {
		if (StringUtils.isEmpty(hql)) {
			throw new IllegalStateException("hql is null");
		}
		if (ObjectUtils.isEmpty(params)) {
			return getHibernateTemplate().executeFind(
					new HibernateCallback<Object>() {
						public Object doInHibernate(Session session) {
							return session.createQuery(hql)
									.setFirstResult(startRow)
									.setMaxResults(pageSize).list();
						}
					});
		} else {
			return getHibernateTemplate().executeFind(
					new HibernateCallback<Object>() {
						public Object doInHibernate(Session session) {
							Query query = session.createQuery(hql);
							for (int i = 0; i < params.length; i++) {
								query.setParameter(i, params[i]);
							}
							return query.setFirstResult(startRow)
									.setMaxResults(pageSize).list();
						}
					});
		}
	}

	public <E> E get(Class<E> entityClass, Serializable id) {
		this.getHibernateTemplate().setCacheQueries(true);
		return this.getHibernateTemplate().get(entityClass, id);
	}

	public <E> Iterator<E> iterate(String queryString) {
		return getHibernateTemplate().iterate(queryString);
	}

	public <E> Iterator<E> iterate(String queryString, Object... values) {
		return getHibernateTemplate().iterate(queryString, values);
	}

	public <E> E load(Class<E> entityClass, Serializable id) {
		return getHibernateTemplate().load(entityClass, id);
	}

	public <E> void persist(E entity) {
		getHibernateTemplate().persist(entity);
	}

	public <E> void refresh(E entity) {
		getHibernateTemplate().refresh(entity);
	}

	public <E> Serializable save(E entity) {
		if (entity == null) {
			throw new IllegalArgumentException("entity is null");
		}
		return getHibernateTemplate().save(entity);
	}

	public <E> void saveOrUpdate(E entity) {
		getHibernateTemplate().saveOrUpdate(entity);
	}

	public <E> void saveOrUpdateAll(Collection<E> entities) {
		getHibernateTemplate().saveOrUpdateAll(entities);
	}

	public <E> void update(E entity) {
		getHibernateTemplate().update(entity);
	}

	public <T> void updateAll(Collection<T> entities) {
		if (CollectionUtils.isEmpty(entities)) {
			throw new IllegalArgumentException("entities is null");
		}
		int i = 0;
		for (Object obj : entities) {
			if (i % 30 == 0) {
				getHibernateTemplate().flush();
				getHibernateTemplate().clear();
			}
			getHibernateTemplate().update(obj);
			i++;
		}
	}

	public <E> void saveAll(Collection<E> entities) {
		if (CollectionUtils.isEmpty(entities)) {
			throw new IllegalArgumentException("entities is null");
		}
		int i = 0;
		for (E obj : entities) {
			if (i % 30 == 0) {
				getHibernateTemplate().flush();
				getHibernateTemplate().clear();
			}
			save(obj);
			i++;
		}
	}

	public <E> List<E> findByPage(String queryString, PageModel pageModel,
			List<?> params) {

		String hql = queryString;
		if (queryString.toLowerCase().indexOf("where") == -1) {
			Matcher m = Pattern.compile("and").matcher(queryString);
			if (m.find()) {
				hql = m.replaceFirst("where");
			} else {
				m = Pattern.compile("AND").matcher(queryString);
				if (m.find()) {
					hql = m.replaceFirst("WHERE");
				}
			}
		}
		int fromIndex = hql.toLowerCase().indexOf("from");
		int orderIndex = hql.toLowerCase().indexOf("group by");
		String hqlCount = "select count(*) "
				+ hql.substring(fromIndex,
						orderIndex > 0 ? orderIndex : hql.length());
		int totalCount = (params == null || params.isEmpty()) ? count(hqlCount)
				: count(hqlCount, params.toArray());
		pageModel.setRecordCount(totalCount);
		if (totalCount == 0) {
			return new ArrayList<E>();
		}
		Object[] temps = (params == null || params.isEmpty()) ? new Object[] {}
				: params.toArray();
		return this.findByPage(hql, pageModel.getStartRow(),
				pageModel.getPageSize(), temps);
	}

}

 

 

 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:mvc="http://www.springframework.org/schema/mvc" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:aop="http://www.springframework.org/schema/aop" 
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:oscache="http://www.springmodules.org/schema/oscache"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
	 	 http://www.springframework.org/schema/beans/spring-beans-3.1.xsd 
	 	 http://www.springframework.org/schema/context
	 	 http://www.springframework.org/schema/context/spring-context-3.1.xsd 
	 	 http://www.springframework.org/schema/aop 
	 	 http://www.springframework.org/schema/aop/spring-aop-3.1.xsd 
	 	 http://www.springframework.org/schema/tx 
	 	 http://www.springframework.org/schema/tx/spring-tx-3.1.xsd 
	 	 http://www.springmodules.org/schema/oscache 
	 	 http://www.springmodules.org/schema/cache/springmodules-oscache.xsd
	 	 http://www.springframework.org/schema/mvc
	 	 http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">

	<!--
		 对web包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能 
		 mvc:annotation-driven
	--> 
	<mvc:annotation-driven/>
	<!-- 扫描包 -->
	<context:annotation-config/>  
	<context:component-scan base-package="com.org.*" />
	
	<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
		  <property name="prefix" value="/jsp/" />
		<property name="suffix" value=".jsp" />  
	</bean>
	
	<!-- 配置jdbc -->
	<bean class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
		<property name="locations">
			<value>classpath:properties/jdbc.properties</value>
		</property>
	</bean>
	<!-- 配置數據源 -->
	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="${jdbc.driver}" />
		<property name="url" value="${jdbc.url}" />
		<property name="username" value="${jdbc.username}" />
		<property name="password" value="${jdbc.password}" />
		<!-- 连接池启动时的初始值 -->
        <property name="initialSize" value="1"/>  
        <property name="maxActive" value="500"/>    
        <property name="maxIdle" value="2"/>        
        <property name="minIdle" value="1"/> 
	</bean>
		<!-- 配置sessionFactory 
		注解配置
			org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean
		配置形式:
			org.springframework.orm.hibernate3.LocalSessionFactoryBean
		-->
		
	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
	 	 <property name="packagesToScan">
			<list>
				<value>com.org.entity</value>
			</list>
		</property>
		 
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">${hibernate.dialect}</prop>
				<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>
	</bean>
	
	<!-- 配置hibernateTemplate -->
	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
	
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
	<!-- Spring AOP config配置切点 -->  
	<aop:config>
		<aop:pointcut expression="execution(public * com.org.service.*.*(..))"
			id="bussinessService" />
		<aop:advisor advice-ref="txAdvice" pointcut-ref="bussinessService" />
	</aop:config>

	<!-- 配置那个类那个方法用到事务处理 -->
	<tx:advice id="txAdvice" transaction-manager="transactionManager">
		<tx:attributes>
			<tx:method name="get*" read-only="true" />
			<tx:method name="add*" propagation="REQUIRED" />
			<tx:method name="update*" propagation="REQUIRED" />
			<tx:method name="delete*" propagation="REQUIRED" />
			<tx:method name="*" propagation="REQUIRED" />
		</tx:attributes>
	</tx:advice>
	
	
<!-- 这个映射配置主要是用来进行静态资源的访问 -->
 <mvc:resources mapping="/js/**" location="/js/" cache-period="31556926"/> 
 <mvc:resources mapping="/resource/**" location="/resource/" />  
 <mvc:resources mapping="/jsp/**" location="/jsp/" /> 
 
</beans>

 

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
 <!--
		#####################################配置处理乱码#####################################
	-->
	<filter>
		<filter-name>encodingFilter</filter-name>
		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
		<init-param>
			<param-name>encoding</param-name>
			<param-value>GBK</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>encodingFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<!--
		#####################################Spring	MVC配置#################################
		application-servlet.xml,规定:xxx-servlet.xml
	-->
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<context-param>
	 
		<param-name>contextConfigLocation</param-name>
		<!--
			param-name必须要等于contextConfigLocation
			默认的配置
			<param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>
		-->
		<param-value>classpath:spring-*.xml</param-value>
	</context-param>

	
	<servlet>
		<servlet-name>springMVC</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>classpath:spring-*.xml</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>springMVC</servlet-name>
		<url-pattern>*.do</url-pattern>
	</servlet-mapping>
	
	<!--
		#####################################struts2配置#######################################
	-->

	<!-- 此配置在使用struts2 -->
 		<filter> 
 			<filter-name>struts2</filter-name> 
 			<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> 
 		</filter> 
		<filter-mapping> 
			<filter-name>struts2</filter-name> 
			<url-pattern>/*</url-pattern> 
		</filter-mapping> 
	<!--
		################################使用freemaker模板中启动JSPSupportServlet#############################
	
	<servlet>
		<servlet-name>JspSupportServlet</servlet-name>
		<servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	-->
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

 



 

 

 

 源代码

  • 大小: 17.5 KB
  • 大小: 16.5 KB
  • 大小: 64.9 KB
1
0
分享到:
评论
3 楼 jilong-liang 2014-05-08  
shizhangliao 写道
userList1.do 为什么返回404?

请求路径是:http://localhost:8080/项目/userList1.do就OK了
请求路径是:http://localhost:8080/项目/userList2.do就OK了
2 楼 shizhangliao 2014-05-06  
后台没有报任何错误
1 楼 shizhangliao 2014-05-06  
userList1.do 为什么返回404?

相关推荐

    spring mvc + spring + hibernate 全注解整合开发视频教程 06.haozip03

    spring mvc + spring + hibernate 全注解整合开发视频教程 06.haozip03

    spring mvc + spring + hibernate 全注解整合开发视频教程 04

    在本视频教程“Spring MVC + Spring + Hibernate 全注解整合开发视频教程 04”中,我们将深入探讨Java企业级开发中的三大核心技术——Spring、Spring MVC和Hibernate的集成与应用,尤其是通过注解实现的简化配置。...

    idea工具创建的Spring+SpringMVC+Hibernate+maven项目

    标题中的"idea工具创建的Spring+SpringMVC+Hibernate+maven项目"指的是使用IntelliJ IDEA这个集成开发环境(IDE)构建的一个Java Web项目,该项目整合了四个关键的技术框架:Spring、SpringMVC、Hibernate以及Maven...

    spring mvc + spring + hibernate 全注解整合开发视频教程 11

    在本教程中,我们将深入探讨如何使用Spring MVC、Spring和Hibernate三大框架进行全注解的整合开发。这个视频教程系列的第11部分,重点可能是建立在前几部分的基础之上,进一步深化对这三个核心技术的理解和实践。 ...

    spring mvc + spring + hibernate 全注解整合开发视频教程 12

    在本教程中,我们将深入探讨如何使用Spring MVC、Spring和Hibernate三大框架进行全注解的整合开发。这个视频教程系列的第12部分,将帮助开发者掌握如何在Java Web项目中高效地集成这三个核心框架,实现松耦合、可...

    基于注解的springMVC+hibernate+oracle包含数据库查询

    综上所述,基于注解的SpringMVC+Hibernate+Oracle的整合主要涉及以下几个关键知识点: 1. SpringMVC的注解驱动:`@Controller`、`@RequestMapping`、`@Autowired`等。 2. Hibernate的注解映射:`@Entity`、`@Table`...

    SpringMVC+Hibernate整合的登录Demo 导入即可直接运行适合初次接触整合

    这篇描述提到的是一个适合初学者的登录Demo,它包含了完整的SpringMVC与Hibernate的整合示例,便于理解和实践。 1. **SpringMVC框架**:SpringMVC是Spring框架的一部分,主要负责处理HTTP请求,将请求分发到对应的...

    Spring+SpringMVC+Hibernate非注解版

    【标题】"Spring+SpringMVC+Hibernate非注解版" 涵盖了Java开发中的三大核心框架,它们是Spring、SpringMVC和Hibernate。这些框架协同工作,为Java Web应用程序提供了一种高效且模块化的开发方式。Spring作为整体...

    spring+springMVC+Hibernate整合

    在IT行业中,Spring、SpringMVC和Hibernate是三个非常重要的框架,它们分别专注于不同领域的功能。Spring是一个全面的Java企业级应用开发框架,提供依赖注入(DI)和面向切面编程(AOP)等核心特性;SpringMVC是...

    SpringMVC+HIbernate登录程序并进行增删改查

    SpringMVC+Hibernate登录程序并进行增删改查是一个经典的Web开发示例,它整合了两个重要的Java技术框架——SpringMVC和Hibernate,用于构建基于Java的动态网站应用。SpringMVC是Spring框架的一部分,主要负责处理...

    Spring+SpringMVC+Hibernate 框架整合

    在"Spring+SpringMVC+Hibernate 框架整合"中,这三者的核心功能和整合方式是主要的知识点。 Spring是一个全面的后端开发框架,它提供了依赖注入(DI)和面向切面编程(AOP)等核心特性,用于简化应用的创建和管理。...

    SpringMVC+hibernate4.3+Spring4.1整合demo

    **SpringMVC+Hibernate4.3+Spring4.1整合详解** 在当今的Java Web开发领域,SpringMVC、Hibernate和Spring(SSH)是极为流行的三大框架,它们各自负责不同的职责,共同构建出高效、可维护的Web应用程序。SpringMVC...

    spring mvc + spring + hibernate 全注解整合开发视频教程 14.haozip02

    spring mvc + spring + hibernate 全注解整合开发视频教程 14.haozip02

    spring+springMVC+jpa+hibernate框架整合

    在IT领域,构建高效、可扩展的Web应用是至关重要的,而"spring+springMVC+jpa+hibernate框架整合"就是一个常见的解决方案。这个整合涉及到四个关键的技术栈:Spring框架、SpringMVC、JPA(Java Persistence API)...

    SpringMVC+Hibernate+Spring+JSP整合实例

    "SpringMVC+Hibernate+Spring+JSP整合实例"是一个经典的后端技术组合,它涵盖了Java领域中多个核心框架的集成应用,旨在实现数据持久化、业务逻辑处理以及用户界面展示的无缝连接。下面我们将深入探讨这些技术及其...

    SpringMVC+hibernate实例

    3. SpringMVC中使用Hibernate的整合,如声明事务管理器、配置DataSource、注入SessionFactory等。 4. 控制器(Controller)的编写,包括RequestMapping注解的使用、模型数据的绑定与传递。 5. Service层的设计,如何...

    springmvc+spring+hibernate

    6. **编写实体类**:根据数据库表结构,创建对应的Java实体类,并使用Hibernate的注解(如@Entity、@Table、@Id等)进行ORM映射。 7. **DAO和Service层**:创建DAO接口和实现类,利用Hibernate的Session进行数据库...

    springmvc+hibernate完整项目

    总的来说,这个"springmvc+hibernate完整项目"提供了一个基础的Web应用框架,涵盖了前后端交互、数据库操作和业务逻辑处理的全过程。学习和研究这个项目,可以深入理解SpringMVC和Hibernate的集成使用,提升Java Web...

    Spring+SpringMVC +Hibernate 整合

    Spring、SpringMVC和Hibernate是Java开发中三大核心框架,它们的整合是企业级Web应用的常见架构选择。Spring作为基础框架,提供了依赖注入(DI)和面向切面编程(AOP)等功能;SpringMVC则负责处理HTTP请求,实现...

Global site tag (gtag.js) - Google Analytics