Spring Data JPA采用Maven搭建项目实现及常用问题解析

1. 问题总结

   (1) Spring data jpa 对常用的增删改查还是非常方便,对于动态SQL查询则不太方便和有一定的学习成本,当然这也是它ORM模式的特点

   (2) 配置pom时需要注意spring、spring data jpa 、hibernate的版本组合,本文第一点中的版本为可用组合版本

    (3) 如何将JpaRepository接口 和 实现类(用实现类的方法体来实现复杂的动态SQL)进行灵活组合? 如果能这样它就完美了

2. pom配置


		1.0.0
		UTF-8
		1.8
		4.12
		1.9.5
		2.4.9
		2.5
		2.3.1
		1.2
		4.3.18.RELEASE
		0.9.2.1
		2.2.9
		1.7.5
		1.0.13
		1.4.3
		2.2.7
		5.1.6
		1.6
		3.3.2
		3.0-rc4
		1.0.4
		1.6.1
		1.1
		1.2.2
		2.4
		1.1.41
		2.5.0
		1.10.11.RELEASE
		3.9
		1.0.1
		2.6.0
		1.1.4
		2.8.1
	

	

		
		
			junit
			junit
			${junit.version}
			test
		


		
		
			javax.servlet
			servlet-api
			${servlet.api.version}
			provided
		

		
			javax.servlet.jsp
			javax.servlet.jsp-api
			${jsp.api.version}
			provided
		

		
			jstl
			jstl
			${jstl.version}
		
		
			mysql
			mysql-connector-java
			${mysql.version}
		

		
		
			org.springframework
			spring-context
			${spring.version}
			compile
		
		
		
			org.springframework
			spring-webmvc
			${spring.version}
		

		
			org.springframework
			spring-jdbc
			${spring.version}
		

		
		
			org.springframework
			spring-orm
			${spring.version}
			runtime
		

		
		
			org.springframework
			spring-tx
			${spring.version}
			compile
		
 
		
		
			org.springframework
			spring-test
			${spring.version}
		

		
		
			org.slf4j
			slf4j-api
			${slf4j.version}
			compile
		
		
			org.slf4j
			log4j-over-slf4j
			${slf4j.version}
			runtime
		
		
			ch.qos.logback
			logback-classic
			${logback.version}
			runtime
		
		
			ch.qos.logback
			logback-core
			${logback.version}
			runtime
		
		
			javax.xml.bind
			jaxb-api
			${jaxb-api.version}
		
		
			org.apache.commons
			commons-lang3
			${commons-lang3.version}
		
		
			commons-codec
			commons-codec
			${commons-codec.version}
		

		
			commons-httpclient
			commons-httpclient
			${commons-httpclient.version}
		

		
			commons-logging
			commons-logging
			${commons-logging.version}
		

		
			dom4j
			dom4j
			${dom4j.version}
		

		
			org.jdom
			jdom
			${jdom.version}
		
		
		
			com.fasterxml.jackson.core
			jackson-databind
			${jackson.version}
		
		
			com.fasterxml.jackson.core
			jackson-annotations
			${jackson.version}
		
		
			com.fasterxml.jackson.core
			jackson-core
			${jackson.version}
		
		
		
		
			commons-fileupload
			commons-fileupload
			${commons-fileupload.version}
		
		
			commons-io
			commons-io
			${commons-io.version}
		

		

		
			log4j
			log4j
			1.2.16
		

		
		
			org.quartz-scheduler
			quartz
			2.1.1
		
		
			org.quartz-scheduler
			quartz-jobs
			2.2.1
		

		
		
			org.springframework
			spring-context-support
			${spring.version}
		

		
			jaxen
			jaxen
			${jaxen.version}
		
		
		
        	org.springframework.data
        	spring-data-jpa
       		1.8.0.RELEASE
    	
     	 
		
			org.hibernate
			hibernate-core
			5.3.7.Final
		
		
			org.hibernate
			hibernate-entitymanager
			5.3.7.Final
		
		
		
			aspectj
			aspectjweaver
			1.5.4
		
		 
	

3.spring xml配置


	
        
    
	
	
	
    
    
    
    
    
    
        
        
        
            
                
                
                
                
            
        
        
            
        
        
            
                
                
                
                
                
                
                
            
        
    
    
    
    
        
            
            
            
            
            
            
            
            
        
    
    
    
        
        
    

4. 引用说明

详细实现步骤可以参考 https://www.cnblogs.com/dreamroute/p/5173896.html

JpaRepository接口相关可以参考 https://blog.csdn.net/fly910905/article/details/78557110

你可能感兴趣的:(Spring)