I'm getting an Oracle error / org.hibernate.exception.SQLGrammarException when I run a JUnit test against a Java class which uses JPA and Spring:
ORA-00904: "ALIAS"."COLUMN_NAME": invalid identifier
The odd thing is that the JUnit test works when run against a development database but fails when run against a database which I use for Continuous Integration builds (they are both Oracle databases).
Therefore, this would suggest that there's something missing or awry in the latter d/b. However, I have double- (and triple-)checked that the table referred to is identical in both databases and contains the column COLUMN_NAME that the error is referring to.
Further information - the DAO Java class invoked in the JUnit test uses a javax.persistence.EntityManager:
MyClass myObject = entityManager.find(MyClass.class, idNumber);
The MyClass JPA entity class maps onto the Oracle table:
@Configurable
@Entity
@Table(name = "MyTable", schema = "MySchema")
public class MyClass implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "MY_SEQ")
@SequenceGenerator(name = "MY_SEQ", sequenceName = "MY_SEQ", allocationSize = 1)
@Column(name = "ID")
protected BigDecimal id;
@Column(name = "COLUMN_NAME")
private String columnName;
...
}
The column COLUMN_NAME in the database table in both databases is VARCHAR2(50) and nullable.
Versions:
Java - 1.6
Spring - 3.1.1
Oracle - 11.2.0.3.0
Thanks in advance for any assistance.
"which makes its name case-sensitive. See this sqlfiddle demo - the 2 tables look the same but one will give results and the otherORA-00904- A.B.Cadedesc MyTableon the database and post the result? - Johanna