Files
spring-data-demo/r2dbc/src/main/java/com/ankurm/r2dbc/Customer.java
T

16 lines
538 B
Java

package com.ankurm.r2dbc;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
/**
* A plain row. Note what is NOT here: no {@code List<PurchaseOrder>} field, no
* @OneToMany. Spring Data R2DBC maps one row to one object and nothing else.
*/
@Table("customer")
public record Customer(@Id Long id, String name, String email, String tier) {
public static Customer ofNew(String name, String email, String tier) {
return new Customer(null, name, email, tier);
}
}