Tag: java

ORA-00957: duplicate column name with Hibernate

This error was particularly annoying, because it didn’t appear on my local machine, but only on the remote environment. Environments were exactly the same: Apache versions, Oracle driver versions,  the same DB is used. Everything else is same, because builds are managed by IVY. 

Looking at SQL that was generated, Hibernate was generating duplicate column names when an entity with several JOINED entities was being retrieved. I couldn’t set alias for related entities because I am using Criteria API and all relationships are configured by annotations.

I am still not sure what is the problem. The way I solved it is by making all related entities load LAZILY. Please let me know if someone finds an answer to this.