Fix conversion operation when the entity is a record.
Give a record:
@Entity
public record Car(@Id Long plate, @Column("model") String model,
@Column("manufacturer") String manufacturer,
@Column("year") int year) {
}
When databases change a field or an ID in an insert operation, the current behavior changes the ID directly it works fine if an entity, but it does not work with a record.
@Inject
private Template template;
....
Car car = new Car(null, "SF90", "Ferrari", 2023);
Car updated = template.insert(car);//it will return the same car reference without the id.
This PR verifies if the entity is a record and creates a new instance with all the data from this operation, thus:
@Inject
private Template template;
....
Car car = new Car(null, "SF90", "Ferrari", 2023);
Car updated = template.insert(car);//it from data such as MongoDB or Neo4J with Apache Tinkerpop
Change
Give a record:
When databases change a field or an ID in an insert operation, the current behavior changes the ID directly it works fine if an entity, but it does not work with a record.
This PR verifies if the entity is a record and creates a new instance with all the data from this operation, thus: