Category Archives: hibernate.MappingException

Caused by: org.hibernate.MappingException: Could not determine type for: XXX, at table: XXXX, for columns: YYYY

This is a common hibernate mapping exception and in most cases you simply forgot to implement

toString()
hashCode()
equals()

in your class you are using a relation to another class (only when using annotations)

Another thing what could be the cause of this could be to mix the annotations between above the fields and above the getter MEthods.
Try to put all the annotations consistent above the getter methods AND not above the data fields.

So:
instead of :
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = “count”)
public long id;

public long getId() {
return id;
}

alter all of them to:

public long id;

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = “count”)
public long getId() {
return id;
}