Package org.jboss.forge.addon.javaee.facets

Examples of org.jboss.forge.addon.javaee.facets.PersistenceFacet


   public FileResource<?> setup(String unitName, Project project, JPADataSource dataSource, boolean configureMetadata)
   {
      FileResource<?> result = null;
      if (project != null)
      {
         PersistenceFacet facet = facetFactory.install(project, PersistenceFacet.class);
         PersistenceContainer container = dataSource.getContainer();
         PersistenceProvider provider = dataSource.getProvider();
         PersistenceDescriptor config = facet.getConfig();
         PersistenceUnit<PersistenceDescriptor> unit = config.createPersistenceUnit();
         unit.name(unitName).description(DEFAULT_UNIT_DESC);
         unit.transactionType(container.isJTASupported() ? PersistenceUnitTransactionType._JTA
                  : PersistenceUnitTransactionType._RESOURCE_LOCAL);
         unit.provider(provider.getProvider());

         container.setupConnection(unit, dataSource);
         provider.configure(unit, dataSource);
         facet.saveConfig(config);
         result = facet.getConfigFile();
      }
      if (configureMetadata)
      {
         facetFactory.install(project, PersistenceMetaModelFacet.class);
      }
View Full Code Here


   private JavaClass findEntity(Project project, final String entity) throws FileNotFoundException
   {
      JavaClass result = null;

      PersistenceFacet scaffold = project.getFacet(PersistenceFacet.class);
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);

      if (entity != null)
      {
         result = getJavaClassFrom(java.getJavaResource(entity));
         if (result == null)
         {
            result = getJavaClassFrom(java.getJavaResource(scaffold.getEntityPackage() + "." + entity));
         }
      }

      if (result == null)
      {
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.javaee.facets.PersistenceFacet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.