Also support synonyms for schema validation

Description

At the moment, if you activate "hibernate.hbm2ddl.auto=validate", then hbm2ddl will fail since it won't look for synonyms.

The related code seems to be in DatabaseMetadata :

might be replaced with something like

I'm gonna have a look at the code to see if I can provide a patch.
I also found some seemingly related JIRAs, but I filed this one since I didn't find something specific to synonyms (I'll also have to get my hands dirty with Gradle, fingers crossed ).

Thanks

Environment

JBoss EAP 5.1.1

Activity

Show:
Rafael Oliveira
May 15, 2013, 1:50 AM

I'm using hibernate-core-4.2.1.Final.jar in project, I add a property in persistence.xml, like that:
[property name="hibernate.synonyms" value="true"]
When I'm starting the server, I get an error 'schema validation', saying 'table not found', but, it is a Synonym.

only these configuration in my project, it should works?

Brett Meyer
May 15, 2013, 2:03 AM

, follows this up with an additional fix. Give that a try (4.2.2-SNAPSHOT). Alternatively, add "hibernate.connection.includeSynonyms=true"

Rafael Oliveira
May 15, 2013, 5:40 PM

Hi,
I try it: 4.2.2-SNAPSHOT version, but it does not work.

1. Log console JBoss:
14:11:51,829 INFO [Version] HHH000412: Hibernate Core {4.2.2-SNAPSHOT}

2. Exception: org.hibernate.HibernateException
Missing column: ID_TESTE_D in ATHOS_DES.TESTE_D

Brett Meyer
May 15, 2013, 9:06 PM

, are you using a datasource? If so, the "includeSynonyms" property needs to be added there.

Rafael Oliveira
May 16, 2013, 6:44 PM

Thank you very much Brett Meyer
it works correctly added that property in datasource file standalone.xml

Assignee

Brett Meyer

Reporter

Baptiste Mathus

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure