Hi,
I'm running hbm2ddl on an entity (corresponding to a table named "Children" for this example) with the following annotation:
Code:
@JoinColumn(name = "`familyId`", nullable = false)
@ManyToOne
@ForeignKey(name = "`fkFamily`")
@Index(name = "`familyIndex`")
private Family family;
When I do, I get the following error:
Quote:
[hibernatetool] An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
[hibernatetool] To get the full stack trace run ant with -verbose
[hibernatetool] org.hibernate.MappingException: Unable to find logical column name from physical name familyId in table Children
The error goes away if I remove the backticks from around familyId, or if I remove the @Index annotation (even if I add the same index via the org.hibernate.annotations.Table annotation).
Perhaps more disturbingly, the @Index annotation doesn't replace backticks with quotes. If I use these annotations:
Code:
@JoinColumn(name = "familyId", nullable = false)
@ManyToOne
@ForeignKey(name = "`fkFamily`")
@Index(name = "`familyIndex`")
private Family family;
then I get this:
Quote:
create index `familyIndex` on "Children" (family);
(Those are backticks around familyIndex, which would be troublesome if I tried to execute the code.) Are other people able to use backticks to quote their index identifiers? It's not a big deal, but it's my aesthetic preference. I'm using Hibernate Tools v3.20 GA and org.hibernate.dialect.PostgreSQLDialect.