當前位置: 首頁>>代碼示例>>Java>>正文


Java PersistenceUnitCommon類代碼示例

本文整理匯總了Java中org.jboss.shrinkwrap.descriptor.api.persistence.PersistenceUnitCommon的典型用法代碼示例。如果您正苦於以下問題:Java PersistenceUnitCommon類的具體用法?Java PersistenceUnitCommon怎麽用?Java PersistenceUnitCommon使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PersistenceUnitCommon類屬於org.jboss.shrinkwrap.descriptor.api.persistence包,在下文中一共展示了PersistenceUnitCommon類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setupConnection

import org.jboss.shrinkwrap.descriptor.api.persistence.PersistenceUnitCommon; //導入依賴的package包/類
@Override
public PersistenceUnitCommon setupConnection(PersistenceUnitCommon unit, JPADataSource dataSource) {
   unit.transactionType("JTA");

   if (dataSource.getDatabase() == null)
   {
      dataSource.setDatabase(DatabaseType.H2);
   }

   return unit;
}
 
開發者ID:forge,項目名稱:springboot-addon,代碼行數:12,代碼來源:SpringBootPersistenceContainer.java

示例2: initializeUI

import org.jboss.shrinkwrap.descriptor.api.persistence.PersistenceUnitCommon; //導入依賴的package包/類
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void initializeUI(UIBuilder builder) throws Exception
{
   UIContext context = builder.getUIContext();
   Project project = getSelectedProject(context);
   JPAFacet<PersistenceCommonDescriptor> persistenceFacet = project.getFacet(JPAFacet.class);
   JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
   List<String> persistenceUnits = new ArrayList<>();
   List<PersistenceUnitCommon> allUnits = persistenceFacet.getConfig().getAllPersistenceUnit();
   for (PersistenceUnitCommon persistenceUnit : allUnits)
   {
      persistenceUnits.add(persistenceUnit.getName());
   }
   if (!persistenceUnits.isEmpty())
   {
      persistenceUnit.setValueChoices(persistenceUnits).setDefaultValue(persistenceUnits.get(0));
   }

   // TODO: May detect where @Path resources are located
   packageName.setDefaultValue(javaSourceFacet.getBasePackage() + ".rest");

   RestResourceGenerator defaultResourceGenerator = null;
   for (RestResourceGenerator generator : resourceGenerators)
   {
      if (generator.getName().equals(RestGenerationConstants.JPA_ENTITY))
      {
         defaultResourceGenerator = generator;
      }
   }
   generator.setDefaultValue(defaultResourceGenerator);
   generator.setItemLabelConverter(
            context.getProvider().isGUI() ? RestResourceGenerator::getDescription : RestResourceGenerator::getName);
   builder.add(generator).add(packageName).add(persistenceUnit);
}
 
開發者ID:forge,項目名稱:angularjs-addon,代碼行數:36,代碼來源:JSONRestResourceFromEntityCommand.java


注:本文中的org.jboss.shrinkwrap.descriptor.api.persistence.PersistenceUnitCommon類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。