0

Within Hibernate I constantly get the error:

ORA-00904: "TABLE_"."COLUMNNAME": invalid identifier

It only ever seems to be when I have:

@Column(nullable=false)
private String bankID;

Rather than e.g:

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

Is it necessary to have the column name for every field within my entities?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
java123999
  • 6,974
  • 36
  • 77
  • 121

2 Answers2

1
ORA-00904: "TABLE_"."COLUMNNAME": invalid identifier

Is actually an oracle error, you can see its cause here : ORA-00904: invalid identifier

The problem is probably that with the name of column set to "bankID", as the previous question says the column must be referred to from now on with double quotes, I probably think that bankID is primary/foreign key, hibernate tries to refer to it without double quotes and thus the error.

Now when you write Column(name="BANK_ID",..., you're following the previous question's advice : put all characters in upper case.

Honestly I don't know if you can consider this a Hibernate bug or opinion(maybe they should mention it in the docs), if it was already filed as a bug and got fixed then upgrading would solve your issue.

Note

every error that starts with ORA is probably an oracle error, you can google the number after it (00904) and you'll mostly get answers .

Community
  • 1
  • 1
niceman
  • 2,653
  • 29
  • 57
0

This can be customized by setting NamingStrategyDelegate (or NamingStrategy in old version) on Configuration. The default naming strategy is to use same value as column name. To insert underscore, you can use ImprovedNamingStrategyDelegate(or ImprovedNamingStrategy).

S.F
  • 76
  • 4