1

I've been receiving the "ORA-00923: FROM keyword not found where expected" error in my code. I am trying to implement CRUD operations using Spring Hibernate. I've checked for syntax errors as well as quotes in my sql query, but can't seem to detect anything out of the ordinary.

User Class:

package com.spring.model;

import javax.persistence.*;

@Entity
@Table(name="PATIENT_MODEL")
public class User {

private int id;
private String patientFirstName;
private String patientLastName;
private String patientEmail;
private String patientAddress1;
private String patientAddress2;

@Id
@GeneratedValue
@Column(name="PATIENT_ID")
public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

@Column(name="PATIENT_FIRST_NAME")
public String getPatientFirstName() {
    return patientFirstName;
}

public void setPatientFirstName(String patientFirstName) {
    this.patientFirstName = patientFirstName;
}

@Column(name="PATIENT_LAST_NAME")
public String getPatientLastName() {
    return patientLastName;
}

public void setPatientLastName(String patientLastName) {
    this.patientLastName = patientLastName;
}

@Column(name="PATIENT_EMAIL_ADDRESS")
public String getPatientEmail() {
    return patientEmail;
}

public void setPatientEmail(String patientEmail) {
    this.patientEmail = patientEmail;
}

@Column(name="PATIENT_ADDRESS_LINE 1")
public String getPatientAddress1() {
    return patientAddress1;
}

public void setPatientAddress1(String patientAddress1) {
    this.patientAddress1 = patientAddress1;
}

@Column(name="PATIENT_ADDRESS_LINE_2")
public String getPatientAddress2() {
    return patientAddress2;
}

public void setPatientAddress2(String patientAddress2) {
    this.patientAddress2 = patientAddress2;
}


}
Javax1304
  • 13
  • 1
  • 4

1 Answers1

5

The problem is the @Column(name="PATIENT_ADDRESS_LINE 1"). Could it be the database column is actually named PATIENT_ADDRESS_LINE_1?

If you really need to use column whose name includes one or more spaces, then you need to instruct Hibernate to quote the column name. Also see Oracle documentation.

Community
  • 1
  • 1
Michal
  • 2,353
  • 1
  • 15
  • 18