Skip to content

Instantly share code, notes, and snippets.

@roshanadh
Created October 21, 2022 13:45
Show Gist options
  • Save roshanadh/b2a3ed7bea790dafc83c2e1ccf6fe56d to your computer and use it in GitHub Desktop.
Save roshanadh/b2a3ed7bea790dafc83c2e1ccf6fe56d to your computer and use it in GitHub Desktop.
Battery resource POJO
package np.com.roshanadhikary.testdemo.entity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import javax.persistence.*;
/**
* Database entity where name, postcode, and capacity are user-supplied fields
*/
@Data
@Entity
@Table(name="batteries")
@RequiredArgsConstructor
@NoArgsConstructor
public class Battery {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column
private int id;
@Column
@NonNull
private String name;
@Column
@NonNull
private String postcode;
@Column
@NonNull
private int capacity;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment