i'm using the Persitence class from javax for generating SQL scripts from our entities. And it works just fine, for the project where i'am currently in. Here is the code:
final Map<Object, Object> properties = new HashMap<>(dialect.getDefaultProperties());
properties.put(AvailableSettings.DIALECT, dialect.getClass().getName());
properties.put(AvailableSettings.CONNECTION_PROVIDER, DriverManagerConnectionProviderImpl.class.getName());
properties.put(AvailableSettings.DEFAULT_SCHEMA, schemaName);
properties.put(AvailableSettings.HBM2DDL_SCRIPTS_ACTION, "create");
properties.put(AvailableSettings.HBM2DDL_CREATE_SOURCE, "metadata");
properties.put(AvailableSettings.HBM2DDL_SCRIPTS_CREATE_TARGET, target.toURI().toURL().toString());
properties.put(AvailableSettings.USE_QUERY_CACHE, "false");
properties.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, "false");
properties.put(AvailableSettings.IMPLICIT_NAMING_STRATEGY, "org.hibernate.boot.model.naming.ImplicitNamingStrategyComponentPathImpl");
properties.put(AvailableSettings.PHYSICAL_NAMING_STRATEGY, SpringPhysicalNamingStrategy.class.getName());
properties.put(AvailableSettings.JPA_VALIDATION_MODE, "ddl, callback");
properties.put(AvailableSettings.HBM2DDL_DATABASE_ACTION, "none");
properties.put(AvailableSettings.DRIVER, "org.h2.Driver");
properties.put(AvailableSettings.URL, "jdbc:h2:mem:export");
properties.put(AvailableSettings.HBM2DDL_DELIMITER, ";");
System.setProperty("line.separator", ";
");
Persistence.generateSchema(schemaName, properties);
Generally it's working fine for the entities in the current project, but not fir external entites. I have a external maven module, which contains some entities i also need to be considered for our SQL script. Is there a way to define the external module in the properties, so the will be considered too ?
question from:
https://stackoverflow.com/questions/65935032/hibernate-schema-generation-consider-entities-from-other-maven-modules 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…