All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.persistence.jpa.configuration.JpaStoreConfigurationBuilder Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version
package org.infinispan.persistence.jpa.configuration;

import static org.infinispan.persistence.jpa.configuration.JpaStoreConfiguration.BATCH_SIZE;
import static org.infinispan.persistence.jpa.configuration.JpaStoreConfiguration.ENTITY_CLASS;
import static org.infinispan.persistence.jpa.configuration.JpaStoreConfiguration.PERSISTENCE_UNIT_NAME;
import static org.infinispan.persistence.jpa.configuration.JpaStoreConfiguration.STORE_METADATA;

import org.infinispan.configuration.cache.AbstractStoreConfigurationBuilder;
import org.infinispan.configuration.cache.PersistenceConfigurationBuilder;
/**
 *
 * @author Ray Tsang
 *
 */
public class JpaStoreConfigurationBuilder
      extends AbstractStoreConfigurationBuilder {

   public JpaStoreConfigurationBuilder(PersistenceConfigurationBuilder builder) {
      super(builder, JpaStoreConfiguration.attributeDefinitionSet());
   }

   public JpaStoreConfigurationBuilder persistenceUnitName(String persistenceUnitName) {
      attributes.attribute(PERSISTENCE_UNIT_NAME).set(persistenceUnitName);
      return self();
   }

   public JpaStoreConfigurationBuilder entityClass(Class entityClass) {
      attributes.attribute(ENTITY_CLASS).set(entityClass);
      return self();
   }

   public JpaStoreConfigurationBuilder batchSize(long batchSize) {
      attributes.attribute(BATCH_SIZE).set(batchSize);
      return self();
   }

   public JpaStoreConfigurationBuilder storeMetadata(boolean storeMetadata) {
      attributes.attribute(STORE_METADATA).set(storeMetadata);
      return self();
   }

   @Override
   public void validate() {
      // how do you validate required attributes?
      super.validate();
   }

   @Override
   public JpaStoreConfiguration create() {
      return new JpaStoreConfiguration(attributes.protect(), async.create(), singletonStore.create());
   }

   @Override
   public JpaStoreConfigurationBuilder read(JpaStoreConfiguration template) {
      super.read(template);
      return this;
   }

   @Override
   public JpaStoreConfigurationBuilder self() {
      return this;
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy