栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

快速入门JPA&SpringData整合教程入门到精通

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

快速入门JPA&SpringData整合教程入门到精通

为啥写这个博客:

提示:最近项目用到了JPA,就问问技术大牛郝哥JPA的教程有没有,大牛一看,反手给我了一个B站视频网址,快速入门JPA&SpringData整合教程入门到精通
我激动的立马点开链接,开始直接学习,但是没有老师的文档,十分的很难受。
做为资深的" B站白嫖党 ",我灵机一动,看看评论下面有没有资源,于是就发现有UP主的资料获取方法,
好家伙,我直呼内行,我就去加微信啊,加QQ群啊,发现客服小姐姐给的只有视频资料的百度云,但是没有文档,无奈之下,只能自力更生,顺便让后人乘凉!


【创建maven工程导入坐标】:
 
        UTF-8
        5.0.7.Final
    

    
        
        
            junit
            junit
            4.12
            test
        

        
        
            org.hibernate
            hibernate-entitymanager
           ${project.hibernate.version}
        

        
        
            org.hibernate
            hibernate-c3p0
            ${project.hibernate.version}
        

        
        
            log4j
            log4j
            1.2.17
        

        
        
            mysql
            mysql-connector-java
            
            5.1.32
        

创建JPA的核心配置:

1、meta-INF
2、persistence.xml



	
    
        
        org.hibernate.jpa.HibernatePersistenceProvider
        
        
        
            
            
            
            

            
            
            
        
    

3、Customer.java

public class Customer {

    private Long custId;
    private String custName;
    private String custSource;
    private String custLevel;
    private String custIndustry;
    private String custPhone;
    private String custAddress;

    public Long getCustId() {
        return custId;
    }

    public void setCustId(Long custId) {
        this.custId = custId;
    }

    public String getCustName() {
        return custName;
    }

    public void setCustName(String custName) {
        this.custName = custName;
    }

    public String getCustSource() {
        return custSource;
    }

    public void setCustSource(String custSource) {
        this.custSource = custSource;
    }

    public String getCustLevel() {
        return custLevel;
    }

    public void setCustLevel(String custLevel) {
        this.custLevel = custLevel;
    }

    public String getCustIndustry() {
        return custIndustry;
    }

    public void setCustIndustry(String custIndustry) {
        this.custIndustry = custIndustry;
    }

    public String getCustPhone() {
        return custPhone;
    }

    public void setCustPhone(String custPhone) {
        this.custPhone = custPhone;
    }

    public String getCustAddress() {
        return custAddress;
    }

    public void setCustAddress(String custAddress) {
        this.custAddress = custAddress;
    }

    @Override
    public String toString() {
        return "Customer{" +
                "custId=" + custId +
                ", custName='" + custName + ''' +
                ", custSource='" + custSource + ''' +
                ", custLevel='" + custLevel + ''' +
                ", custIndustry='" + custIndustry + ''' +
                ", custPhone='" + custPhone + ''' +
                ", custAddress='" + custAddress + ''' +
                '}';
    }
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/704047.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号