private static PersistenceDescriptor persistenceXml() { return Descriptors.create( PersistenceDescriptor.class ) .version( "2.1" ) .createPersistenceUnit() .name( "primary" ) .transactionType( PersistenceUnitTransactionType._JTA ) .jtaDataSource( "java:jboss/datasources/ExampleDS" ) .getOrCreateProperties() // We want to use the ORM from this build instead of the one coming with WildFly .createProperty().name( "jboss.as.jpa.providerModule" ).value( "org.hibernate:" + ORM_MINOR_VERSION ).up() .createProperty().name( "hibernate.hbm2ddl.auto" ).value( "create-drop" ).up() .createProperty().name( "hibernate.allow_update_outside_transaction" ).value( "true" ).up() .up().up(); }
@Deployment public static WebArchive createDeployment() { return ShrinkWrap.create( WebArchive.class ) .addClass( Kryptonite.class ) .addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" ) .addAsResource( new StringAsset( persistenceXml().exportAsString() ), "META-INF/persistence.xml" ); }
@Override public void saveConfig(PersistenceDescriptor persistenceDescriptor) { final Properties<PersistenceUnit<PersistenceDescriptor>> properties = DESCRIPTOR.getOrCreatePersistenceUnit() .getOrCreateProperties(); final List<Property<Properties<PersistenceUnit<PersistenceDescriptor>>>> propertyList = properties .getAllProperty(); final java.util.Properties toWrite = new java.util.Properties(); for (Property<Properties<PersistenceUnit<PersistenceDescriptor>>> property : propertyList) { toWrite.put(NATIVE_PROPERTIES_PREFIX + property.getName(), property.getValue()); } SpringBootHelper.writeToApplicationProperties(getFaceted(), toWrite); }
/** * Returns the <code>validation-mode</code> element * @return the value found for the element <code>validation-mode</code> */ public PersistenceUnitValidationModeType getValidationMode() { return PersistenceUnitValidationModeType.getFromStringValue(childNode.getTextValueForPatternName("validation-mode")); }
/** * Returns the <code>transaction-type</code> attribute * @return the value defined for the attribute <code>transaction-type</code> */ public PersistenceUnitTransactionType getTransactionType() { return PersistenceUnitTransactionType.getFromStringValue(childNode.getAttribute("transaction-type")); }
/** * Returns the <code>shared-cache-mode</code> element * @return the value found for the element <code>shared-cache-mode</code> */ public PersistenceUnitCachingType getSharedCacheMode() { return PersistenceUnitCachingType.getFromStringValue(childNode.getTextValueForPatternName("shared-cache-mode")); }
private static PersistenceDescriptor persistenceXml() { return Descriptors.create( PersistenceDescriptor.class ) .version( "2.1" ) .createPersistenceUnit() .name( "primary" ) .transactionType( PersistenceUnitTransactionType._JTA ) .jtaDataSource( "java:jboss/datasources/ExampleDS" ) .getOrCreateProperties() // We want to use the ORM from this build instead of the one coming with WildFly .createProperty().name( "jboss.as.jpa.providerModule" ).value( "org.hibernate:" + ORM_MINOR_VERSION ).up() .createProperty().name( "hibernate.hbm2ddl.auto" ).value( "create-drop" ).up() .createProperty().name( "hibernate.allow_update_outside_transaction" ).value( "true" ).up() .up().up(); }
@Deployment public static WebArchive createDeployment() { return ShrinkWrap.create( WebArchive.class ) .addClass( Kryptonite.class ) .addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" ) .addAsResource( new StringAsset( persistenceXml().exportAsString() ), "META-INF/persistence.xml" ); }
/** * Returns the <code>validation-mode</code> element * @return the value found for the element <code>validation-mode</code> */ public PersistenceUnitValidationModeType getValidationMode() { return PersistenceUnitValidationModeType.getFromStringValue(childNode.getTextValueForPatternName("validation-mode")); }
/** * Returns the <code>transaction-type</code> attribute * @return the value defined for the attribute <code>transaction-type</code> */ public PersistenceUnitTransactionType getTransactionType() { return PersistenceUnitTransactionType.getFromStringValue(childNode.getAttribute("transaction-type")); }
/** * Returns the <code>shared-cache-mode</code> element * @return the value found for the element <code>shared-cache-mode</code> */ public PersistenceUnitCachingType getSharedCacheMode() { return PersistenceUnitCachingType.getFromStringValue(childNode.getTextValueForPatternName("shared-cache-mode")); }
private static PersistenceDescriptor persistenceXml() { final PersistenceDescriptor pd = Descriptors.create( PersistenceDescriptor.class ) .version( "2.1" ) .createPersistenceUnit().name( PERSISTENCE_UNIT_NAME ) .transactionType( PersistenceUnitTransactionType._JTA ) .jtaDataSource( "java:jboss/datasources/ExampleDS" ) .clazz( WildFlyDdlEntity.class.getName() ) .excludeUnlistedClasses( true ) .getOrCreateProperties().createProperty().name( "jboss.as.jpa.providerModule" ).value( "org.hibernate:5.3" ).up().up() .getOrCreateProperties().createProperty().name( "hibernate.hbm2ddl.auto" ).value( "create-drop" ).up().up() // this should not be needed, but... .getOrCreateProperties().createProperty().name( AvailableSettings.JTA_PLATFORM ).value( JBossAppServerJtaPlatform.class.getName() ).up().up() .up(); System.out.println( "persistence.xml: " ); pd.exportTo( System.out ); return pd; }
@Deployment public static WebArchive createDeployment() { return ShrinkWrap.create( WebArchive.class ) .addClass( AuditedEntity.class ) .addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" ) .addAsResource( new StringAsset( persistenceXml().exportAsString() ), "META-INF/persistence.xml" ); }
private static PersistenceDescriptor persistenceXml() { return Descriptors.create( PersistenceDescriptor.class ) .version( "2.1" ) .createPersistenceUnit() .name( "primary" ) .transactionType( PersistenceUnitTransactionType._RESOURCE_LOCAL ) .jtaDataSource( "java:jboss/datasources/ExampleDS" ) .getOrCreateProperties() // We want to use the ORM from this build instead of the one coming with WildFly .createProperty() .name( "jboss.as.jpa.providerModule" ) .value( "org.hibernate:" + ORM_MINOR_VERSION ) .up() .createProperty() .name( "hibernate.hbm2ddl.auto" ) .value( "create-drop" ) .up() .createProperty() .name( "hibernate.allow_update_outside_transaction" ) .value( "true" ) .up() .up() .up(); }
@Deployment public static WebArchive buildDeployment() { WebArchive war = ShrinkWrap.create( WebArchive.class ) .setManifest( "org/hibernate/test/wf/ddl/manifest.mf" ) .addClass( WildFlyDdlEntity.class ) // .addAsManifestResource( EmptyAsset.INSTANCE, "beans.xml") .addAsResource( new StringAsset( persistenceXml().exportAsString() ), PERSISTENCE_XML_RESOURCE_NAME ) .addAsResource( "org/hibernate/test/wf/ddl/log4j.properties", "log4j.properties" ); System.out.println( war.toString(true) ); return war; }