Maksim Maksim - 6 months ago 49
Java Question

Hibernate ManyToOne mapping exception

I am making some system, where I need @ManyToOne relation between two entities. I have 2 tables:

enter image description here

My mapping:

@Table(name = "organizer", schema = "eventtracker")
public class OrganizerEntity {
private int organizerId;
private List<EventEntity> events;

@Column(name = "organizerId")
@GeneratedValue(strategy = GenerationType.IDENTITY)
public int getOrganizerId() {
return organizerId;

public void setOrganizerId(int organizerId) {
this.organizerId = organizerId;

//other columns

@OneToMany(fetch = FetchType.EAGER, mappedBy = "organizer")
public List<EventEntity> getEvents() {
return events;

public void setEvents(List<EventEntity> events) { = events;


@Table(name = "event", schema = "eventtracker")
public class EventEntity {
private int eventId;
private OrganizerEntity organizer;

@Column(name = "eventId")
@GeneratedValue(strategy = GenerationType.IDENTITY)
public int getEventId() {
return eventId;

public void setEventId(int eventId) {
this.eventId = eventId;

//other columns

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "organizer", referencedColumnName = "organizerId")
public OrganizerEntity getOrganizer() {
return organizer;

public void setOrganizer(OrganizerEntity organizer) {
this.organizer = organizer;


I get such exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column
organizere4_.e' in 'field list'

Answer Source

Please verify your column names in the database table and in mapping table OrganizerEntity.specially the email field which might be creating the problem here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download