Coder Social home page Coder Social logo

pedrogalv / spring-jpa-jersey Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leonanluppi/spring-jpa-jersey

0.0 2.0 0.0 13 KB

An exercise for Spring Boot, JPA and Jersey. The candidates must show back-end skills with database access.

Java 94.29% HTML 5.71%

spring-jpa-jersey's Introduction

Skills in Spring, JPA and Jersey

Here you will find a scaffold of a project that aims to expose a REST service to list cities. You need to implement this service using the technologies available on the POM file.

  • Java
  • REST with Jersey2
  • JPA
  • Spring 4 / Spring-boot
  • Maven

#Database The actual implementation uses H2 in memory as the database. You will find also the scripts for MySQL. The scripts insert a few entries in each table.

#Proposed exercise The candidate must:

  • Create Entity classes for the tables, including relationships

  • Create the DAO classes to access Data. Feel free to use whatever method you like(Criteria, JPQL, Spring-data, etc).

  • Create "Domain" classes, to mark JPA Sessions. This will be a layer to separate Controller layer from the model

  • Create a GET REST service to retrieve the list of cities in the database, and return them as a JSON object.

  • The service may receive the query param "country" as a String, to restrict the search. The parameter may be part of the Country name

    http://server:port/rest/cities[?country=name]

Feel free to modify the files included, add or remove packages, in every aspect you want. Just check the note regarding JUnit tests below.

#Expected results After the implementation, the application should run after the following command line:

java -jar target/spring-jpa-jersey.jar

or

mvn spring-boot:run

or deploy on Tomcat, or Jetty or an Application Server, as long as you include instructions for the deploy.

Then, open a browser and type :

http://localhost:8090/rest/cities?country=Uni

It must return, at least the following (ids may vary) :

[
    {
        "id":86,
        "name":"New York",
        "country":{
            "id":2,
            "name":"United States"
        }
    },
    {
        "id":87,
        "name":"Los Angeles",
        "country":{
            "id":2,
            "name":"United States"
        }
    },
    {
        "id":88,
        "name":"Atlanta",
        "country":{
            "id":2,
            "name":"United States"
        }
    }
]

#Unit tests

Included you will find JUnit tests, with commented lines. Those tests must run after the lines are uncommented.

spring-jpa-jersey's People

Contributors

pedrogalv avatar ajkret avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.