Created
March 18, 2013 17:26
-
-
Save johnament/5189053 to your computer and use it in GitHub Desktop.
ShrinkWrap can be ugly
This file contains 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
public static void updatePersistence(final PersistenceDescriptor pd) { | |
for (final PersistenceUnit<PersistenceDescriptor> pu : pd.getAllPersistenceUnit()) { | |
Property<Properties<PersistenceUnit<PersistenceDescriptor>>> hbm2ddl = null; | |
for (final Property<Properties<PersistenceUnit<PersistenceDescriptor>>> prop : pu.getOrCreateProperties() | |
.getAllProperty()) { | |
if (prop.getName().equals("hibernate.hbm2ddl.auto")) { | |
hbm2ddl = prop; | |
break; | |
} | |
} | |
if (hbm2ddl == null) { | |
hbm2ddl = pu.getOrCreateProperties().createProperty(); | |
hbm2ddl.name("hibernate.hbm2ddl.auto"); | |
} | |
hbm2ddl.value("create-drop"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment