Spring Boot Annotation Fix

Spring Boot JPA @Entity “invalid identifier” java.sql.SQLException Error

So, I was creating a RESTful service with Spring Boot + Oracle DB, and I got the following error when I visited a REST url that I put in to a @RestController

2015-08-12 11:31:27.470 ERROR 9676 — [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause

java.sql.SQLException: ORA-00904: “CASPRODUCT0_”.”PATH_IMG_THUMB”: invalid identifier

Here is my domain class:

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.data.annotation.Transient;

public class CasProduct {</code>

@Column(name="id", unique=true, nullable=false)
private Long id;

@Column(name="name", nullable=false)
private String name;

@Column(name="codecategory", nullable=false)
private String codeCategory;

@Column(name="namealiasproduct", nullable=false)
private String nameAliasProduct;

private String pathImgThumb;

@Column(name="shortdescription", nullable=false)
private String shortDescription;

public CasProduct() {
this.name = "None Found";
this.codeCategory = "No Category Defined";
this.nameAliasProduct = "No Alias";
this.pathImgThumb = "No Image Path";
this.shortDescription = "Invalid Request";

public CasProduct(String name, String codeCategory, String nameAliasProduct, String shortDescription) {
this.name = name;
this.codeCategory = codeCategory;
this.nameAliasProduct = nameAliasProduct;
this.shortDescription = shortDescription;

public Long getId() {
return id;

public String getCodeCategory() {
return codeCategory;

public void setCodeCategory(String codeCategory) {
this.codeCategory = codeCategory;

public String getName() {
return name;

public void setName(String name) {
this.name = name;

public String getNameAliasProduct() {
return nameAliasProduct;

public void setNameAliasProduct(String NameAliasProduct) {
this.nameAliasProduct = NameAliasProduct;

public String getPathImgThumb() {
return pathImgThumb;

public void setPathImgThumb(String pathImgThumb) {
this.pathImgThumb = pathImgThumb;

public String getShortDescription() {
return shortDescription;

public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;


In the domain class, “pathImgThumb” field is not mapped to the database table, so it is annotated with @Transient. However, the error still appeared. I searched through the Stackflow and other Java sites for the help but with no avail. But I realized what the problem is.

I was using Eclipse IDE to auto import the required libraries, so it imported “import org.springframework.data.annotation.Transient” as the default. However, this won’t work, and this has to be “javax.persistence.Transient“. Thus,

import javax.persistence.Transient;

This should solve the error!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s