package tutorial;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

  public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
  }
}

@jakarta.persistence.Entity(name = "Vehicle")
class Vehicle {

  @jakarta.persistence.Id
  Long id;

  String name;

  public String getName() {
    return name;
  }

  protected Vehicle() {}

  Vehicle(long id, String name) {
    this.id = id;
    this.name = name;
  }
}

@jakarta.persistence.Entity(name = "RecordEntry")
class RecordEntry {

  @jakarta.persistence.Id
  Long id;

  @jakarta.persistence.ManyToOne(fetch = jakarta.persistence.FetchType.LAZY)
  Vehicle vehicle;

  protected RecordEntry() {}

  RecordEntry(long id, Vehicle v) {
    this.id = id;
    this.vehicle = v;
  }
}
