Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hibernate.ejb.naming_strategy ignored with latest release #55

Closed
mcordes opened this issue Jul 2, 2014 · 2 comments
Closed

hibernate.ejb.naming_strategy ignored with latest release #55

mcordes opened this issue Jul 2, 2014 · 2 comments
Milestone

Comments

@mcordes
Copy link

mcordes commented Jul 2, 2014

Hello,

The naming strategy defined in my persistence.xml using the 'hibernate.ejb.naming_strategy' property is no longer being used to affect the names of tables in the change log generated by the diffChangeLog operation. I'm using the ejb3 approach with a reference url: hibernate:ejb3:XXX. Any suggestions?

This worked with past versions, but seems to no longer work with version 3.4 (from maven).

I'm using the latest hibernate: 4.3.5.

-Matt

@rince1013
Copy link

I'm having the same problem

For reference, my referenceUrl is

referenceUrl=hibernate:spring:com.neptune.unsub.model?dialect=org.hibernate.dialect.SQLServerDialect&hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy

I have a workaround, modify liquibase.ext.hibernate.database.HibernateDatabase.setConnection(DatabaseConnection conn)

to add this line

configureNamingStrategy(this.configuration, ((HibernateConnection) ((JdbcConnection) conn).getUnderlyingConnection()));

So it looks like

@Override
public void setConnection(DatabaseConnection conn) {
    super.setConnection(conn);

    try {
        LOG.info("Reading hibernate configuration " + getConnection().getURL());

        this.configuration = buildConfiguration(((HibernateConnection) ((JdbcConnection) conn).getUnderlyingConnection()));
        configureNamingStrategy(this.configuration, ((HibernateConnection) ((JdbcConnection) conn).getUnderlyingConnection()));
        this.configuration.buildMappings();
        this.dialect = configureDialect();


        afterSetup();
    } catch (DatabaseException e) {
        throw new UnexpectedLiquibaseException(e);
    }

}

@nvoxland nvoxland added this to the 3.5 milestone Nov 21, 2014
@nvoxland
Copy link
Contributor

Applied your change, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants