运用jpa技术的beans.xml文件配置
来源:互联网 发布:js 字符串转换为date 编辑:程序博客网 时间:2024/05/22 17:28
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:component-scan base-package="com.itcast"/>
<!-- 使用数据源和指定persistence.xml位置的方式创建entityManagerFactory,如果使用的不是hibernate JPA实现,
需要在tomcat作一些特殊配置.具体参考手册
注意:使用该方式需要把persistence.xml中的hibernate.connection.driver_class,hibernate.connection.username,hibernate.connection.password,hibernate.connection.url配置删除-->
<context:property-placeholder location="classpath:jdbc.properties"/>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${driverClassName}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
<property name="initialSize" value="${initialSize}"/>
<property name="maxActive" value="${maxActive}"/>
<property name="maxIdle" value="${maxIdle}"/>
<property name="minIdle" value="${minIdle}"/>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" />
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
</property>
</bean>
<!--
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="itcast"/>
</bean>
-->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<!-- Activates @Transactional for DefaultImageDatabase -->
<tx:annotation-driven transaction-manager="transactionManager"/>
</beans>
- 运用jpa技术的beans.xml文件配置
- JPA中persistance.xml文件的配置
- hibernate的beans.xml配置
- Spring的beans.xml文件
- JPA配置文档persistence.xml文件的参数说明
- spring beans xml文件头的生成
- jpa的context.xml文件
- JPA的persistence.xml文件
- beans.xml配置
- jpa persistence.xml文件配置详解
- JPA配置多数据源多persistence.xml文件
- JPA的基本运用
- spring+jpa的applicationContext.xml基本配置
- spring框架,可以没有spring.xml(即配置<beans>的文件吗?即不使用xml方式配置,而是只使用注解的方式配置
- 从Spring官网上获取配置Spring框架的beans头文件的步骤(app.xml)
- beans.xml文件头内容
- 不在JPA 的 persistence.xml 文件中配置Entity class的解决办法
- applicationContext的xml配置文件异常:找不到beans的声明文件
- 王国维《人间词话》:“古今之成大事业、大学问者,必经过三种之境界”
- Html学习笔记
- 连接mysql数据库的配置文件代码
- log4j.properties文件配置
- Freetype2 用法
- 运用jpa技术的beans.xml文件配置
- 常用Petri网模拟软件工具简介
- 一个数据库查询方法(可以动态设置查询参数,设置查询条件),很巧妙的组合sql语句
- 如何开发出高质量J2EE系统
- [Business modeling-商业模式]--ITAT
- 【动态规划】HDOJ 1257 最少拦截系统
- http://www.blogjava.net/usherlight/archive/2006/03/02/33264.html
- 《开餐馆与做软件》续——关于架构的辩论
- 一个中文过滤器代码