-
-
Save sebersole/5e14da36e28432a2d9e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.liberologico.cloudesire.cmw.test.unit; | |
import org.hibernate.boot.MetadataSources; | |
import org.hibernate.boot.registry.StandardServiceRegistry; | |
import org.hibernate.boot.spi.MetadataImplementor; | |
import org.hibernate.cfg.AvailableSettings; | |
import org.hibernate.cfg.Configuration; | |
import org.hibernate.dialect.PostgreSQL94Dialect; | |
import org.hibernate.tool.hbm2ddl.SchemaUpdate; | |
import org.hibernate.tool.hbm2ddl.SchemaValidator; | |
import org.junit.Test; | |
import javax.persistence.Entity; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.GenerationType; | |
import javax.persistence.Id; | |
public class HHH10063Bug5 | |
{ | |
@Entity | |
public static class TestEntity { | |
@Id | |
@GeneratedValue (strategy = GenerationType.AUTO) | |
private int id; | |
} | |
@Test | |
public void test() { | |
StandardServiceRegistry ssr = new StandardServiceRegistryBuilder() | |
.applySetting( AvailableSettings.GLOBALLY_QUOTED_IDENTIFIERS, Boolean.TRUE.toString() ) | |
.applySetting( AvailableSettings.DIALECT, PostgreSQL94Dialect.class.getName() ) | |
.applySetting(AvailableSettings.URL, "jdbc:postgresql://localhost/test") | |
.applySetting(AvailableSettings.USER, "postgres") | |
.applySetting(AvailableSettings.PASS, "admin") | |
.build(); | |
MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( ssr ) | |
.addAnnotatedClass(TestEntity.class) | |
.buildMetadata(); | |
new SchemaUpdate(metadata).execute(false, true); | |
new SchemaValidator(metadata).validate(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment