Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Country.java package com.shahin.fleetapp.model; import java.util.List; import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.ObjectIdGenerators; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.OneToMany; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor;

image text in transcribed

Country.java

package com.shahin.fleetapp.model;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;

import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import jakarta.persistence.Entity;

import jakarta.persistence.GeneratedValue;

import jakarta.persistence.GenerationType;

import jakarta.persistence.Id;

import jakarta.persistence.OneToMany;

import lombok.AllArgsConstructor;

import lombok.Data;

import lombok.NoArgsConstructor;

@Entity

@Data

@NoArgsConstructor

@AllArgsConstructor

@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")

public class Country {

@Id

@GeneratedValue(strategy = GenerationType.IDENTITY)

private Integer id;

private String code;

private String capital;

private String description;

private String nationality;

private String continent;

@OneToMany(mappedBy="country")

private List states;

}

----------------------------------

CountryService.java

package com.shahin.fleetapp.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;

import com.shahin.fleetapp.model.Country;

import com.shahin.fleetapp.repositories.CountryRepository;

@Service

public class CountryService {

@Autowired

private CountryRepository countryRepo;

//Return List of countries

public List findAll(){

return countryRepo.findAll();

}

}

--------------------------------------------

CountryRepository

package com.shahin.fleetapp.repositories;

import org.springframework.data.jpa.repository.JpaRepository;

import org.springframework.stereotype.Repository;

import com.shahin.fleetapp.model.Country;

@Repository

public interface CountryRepository extends JpaRepository {

}

Can you please help me to fix this error?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students explore these related Databases questions

Question

What kind of problem is this? How do I know?

Answered: 3 weeks ago

Question

Define promotion.

Answered: 3 weeks ago

Question

Write a note on transfer policy.

Answered: 3 weeks ago