Could not set field value [410] value by reflection

I work with the website “” I import my data.
I have a persistence “MyApp”, 4 classes: Aireline, Airport, Route and RouteId. I use H2 as a database. I have an ImportData class to import my data from the site.
When importing Aireline and Airport data are well filled.
the problem is that for the class Route I had to do a RouteId class because I have several primary keys.
Hibernate raises an exception on my RouteId class:

Could not set field value [410] value by reflection: [class flights.RouteId.airlineId] setter of >> flights.RouteId.airlineId

Maybe the type does not match. Is the value a String while in the class is an Integer?

here is my code:

Route class

public class Route {

private RouteId id;

private String airlineCode;

@ManyToOne // error : The type of the ID mapped by the relationship 'airline' does not agree with the primary key class of the target entity.
private Airline airline;

private String sourceCode;

@ManyToOne // error : The type of the ID mapped by the relationship 'source' does not agree with the primary key class of the target entity.
private Airport source;
private String destinationCode;
@ManyToOne // The type of the ID mapped by the relationship 'destination' does not agree with the primary key class of the target entity.
private Airport destination;
private Boolean codeshare;
private Short stops;
private String equipment;

public RouteId getId() {
	return id;

public void setId(RouteId id) { = id;

public String getAirlineCode() {
	return airlineCode;

public void setAirlineCode(String airlineCode) {
	this.airlineCode = airlineCode;

public Airline getAirline() {
	return airline;

public void setAirline(Airline airline) {
	this.airline = airline;

public String getSourceCode() {
	return sourceCode;

public void setSourceCode(String sourceCode) {
	this.sourceCode = sourceCode;

public Airport getSource() {
	return source;

public void setSource(Airport source) {
	this.source = source;

public String getDestinationCode() {
	return destinationCode;

public void setDestinationCode(String destinationCode) {
	this.destinationCode = destinationCode;

public Airport getDestination() {
	return destination;

public void setDestination(Airport destination) {
	this.destination = destination;

public Boolean getCodeshare() {
	return codeshare;

public void setCodeshare(Boolean codeshare) {
	this.codeshare = codeshare;

public Short getStops() {
	return stops;

public void setStops(Short stops) {
	this.stops = stops;

public String getEquipment() {
	return equipment;

public void setEquipment(String equipment) { = equipment;


RouteId class

@Embeddable // The Java class for mapped type “flights.RouteId” is final
public class RouteId implements Serializable {

private static final long serialVersionUID = -2403746842148223177L;

// assuming all Long ids
private int airlineId;
private int sourceId;
private int destinationId;
public int getAirlineId() {
return airlineId;
public void setAirlineId(int airlineId) {
this.airlineId = airlineId;
public int getSourceId() {
return sourceId;
public void setSourceId(int sourceId) {
this.sourceId = sourceId;
public int getDestinationId() {
return destinationId;
public void setDestinationId(int destinationId) {
this.destinationId = destinationId;
public static long getSerialversionuid() {
return serialVersionUID;
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + airlineId;
result = prime * result + destinationId;
result = prime * result + sourceId;
return result;
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RouteId other = (RouteId) obj;
if (airlineId != other.airlineId)
return false;
if (destinationId != other.destinationId)
return false;
if (sourceId != other.sourceId)
return false;
return true;

// Omitted: constructors, getters/setters
// Omitted: equals, hashCode and toString methods


here is my method of importing Routes

private static Route mapRoute(String[] data) {
Route route = new Route();

	int i = 0;
	route.setAirlineCode( parseNull(data[i++], ImportData::nopParse) );
	Airline airline = new Airline();
	Integer airlineId = parseNull(data[i++], Integer::parseInt);
	if ( airlineId == null ) return null;
	if ( !existingAirline.contains(airlineId) ) return null;
	airline.setId( airlineId );
	route.setAirline( airline );
	route.setSourceCode(parseNull(data[i++], ImportData::nopParse));
	Airport source = new Airport();
	Integer sourceId = parseNull(data[i++], Integer::parseInt);
	if ( sourceId == null ) return null;
	if ( !existingAirport.contains(sourceId) ) return null;
	source.setId( sourceId );
	route.setDestinationCode(parseNull(data[i++], ImportData::nopParse));
	Airport dest = new Airport();
	Integer destId = parseNull(data[i++], Integer::parseInt);
	if ( destId == null ) return null;
	if ( !existingAirport.contains(destId) ) return null;
	dest.setId( destId );
	route.setCodeshare( parseNull(data[i++], ImportData::booleanParse) );
	route.setStops(parseNull(data[i++], Short::parseShort)  );
	route.setEquipment(parseNull(data[i++], ImportData::nopParse));
	return route;

Try to replicate the issue with this test case template.