package com.example.accessingdatajpa;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class Customer {
@Id @GeneratedValue(strategy=GenerationType.AUTO
)
private Long id;
private String firstName; private String lastName;
protected Customer() {} public Customer(String firstName, String lastName)
{ this.firstName = firstName; this.lastName = lastName; }
@Override
public String toString() {
return String.format( "Customer[id=%d, firstName='%s', lastName='%s']", id, firstName, lastName);
} public Long getId() { return id; }
public String getFirstName() {
return firstName; } public String getLastName() { return lastName;
} }
标签:String,firstName,lastName,系统,public,import,id From: https://www.cnblogs.com/z264438/p/17407446.html