Hibernate schema export with Hibernate Validator constraints accepted and Spring configured persistence
What is the goal: using Spring Framework for configuration of persistence settings (JPA 2.0 with Hibernate provider) using the configuration for Hibernate schema export tool apply Hibernate Validator constraints to generated schema Spring persistence configuration // define datasource - hsqldb for testing purposes - it requires hsqldb to be on classpath EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); EmbeddedDatabase database = builder.setType(EmbeddedDatabaseType.HSQL).build(); // standard way how to configure persistence in Spring (usually included as a part of some configuration class) LocalContainerEntityManagerFactoryBean lcemfb = new LocalContainerEntityManagerFactoryBean(); lcemfb.setPersistenceXmlLocation("classpath:example/path/to/persistence.xml"); lcemfb.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); lcemfb.setDataSource(database); lcemfb.afterPropertiesSet(); Create Hibernate configuration from Spring configured persistence Ej...