0
@Entity(name = "Profession")
@Table(name = "PROFESSION")

public class Profession extends DescriptionBase implements OrderableInf {

    @ManyToOne
    @JoinColumn(name = "FIELDNAME")
    private Field field;
}

And:

@Entity(name = "Field")
@Table(name = "FIELD")
public class Field extends DescriptionBase implements OrderableInf {

    @OneToMany(mappedBy = "field", fetch = FetchType.EAGER)
    private List<Profession> professions = new ArrayList<>();

}

Yet when doing a simple 'findAll' I get the following error:

o.h.engine.jdbc.spi.SqlExceptionHelper   : Invalid value for getLong() - 'INDUSTRYTYPE'

What am I doing wrong? Thank you.

Ken Alton
  • 686
  • 1
  • 9
  • 21

1 Answers1

0

You are trying to refer non primary key field as join column which jpa does not support out of the box.

Try changing FIELDNAME to primary key field or use reference column approach to make it work.

Useful links.

JPA does not allow references to non-PK columns.

ReferencedColumn property is used to specify join column, when there is a composite PK in referenced table.

Alien
  • 15,141
  • 6
  • 37
  • 57