Spring Boot case JPA Hibernate Restful SOAP RMI AngularJS

0
79
Spread the love

Spring Boot case JPA Hibernate Restful SOAP RMI AngularJS:

Spring boot codes

IT Project Hierarchy.

IT Project Hierarchy of Entites and Database tables.

So, first of all as we mentioned in this two images, we are going to create a Restful project based on API communication with several connection endpoints JSON or XML for example: Android, Websites, Client SOAP and Client RMI.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.7.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>accessing-data-jpa</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>accessing-data-jpa</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

let’s create entity Client or Class Client.

package com.example.demo;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; 

@Entity
public class  Client implements Serializable{
     @Id  
     @GeneratedValue(strategy=GenerationType.IDENTITY) 
     private Long c;
     private String nameClient;
     @OneToMany (mappedBy="client", fetch=FetchType.Lazy)  
     private Collection<Compte> comptes;


 public  Long getCodeClient () {
 return  Long codeClient ;
 }


 public String getNameClient() {
 return  nameClient;
 }


}

LEAVE A REPLY

Please enter your comment!
Please enter your name here