当前位置: 首页>>代码示例>>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;未经允许,请勿转载。