Examples of PersistenceUnitMetadata


Examples of com.impetus.kundera.metadata.model.PersistenceUnitMetadata

    // 1] class -> persitence unit:
    Map<String, List<String>> clazzHack = new HashMap<String, List<String>>();
    clazzHack.put(clazz.getName(), Arrays.asList(persistenceUnit));
    KunderaMetadata.INSTANCE.getApplicationMetadata().setClazzToPuMap(clazzHack);
    // 2] PU -> class:
    PersistenceUnitMetadata puMeta = KunderaMetadata.INSTANCE.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
    puMeta.getClasses().add(clazz.getName());
    // 3] Classname -> class:
    KunderaMetadataManager.getMetamodel(persistenceUnit).addEntityNameToClassMapping(clazz.getName(), clazz);
    // 4] Add entity metadata
    // (note you can do this without the nasty MetamodelImpl by using KunderaMetadata.INSTANCE.getApplicationMetadata()
    //  but we'll do it like this for consistency with [3])
View Full Code Here

Examples of net.sourceforge.jpaxjc.ns.persistence.orm.PersistenceUnitMetadata

                    orm.setDescription( c.element.getFirstChild().getNodeValue() );
                    acknowledge = true;
                }
                else if ( c.element.getLocalName().equals( "persistence-unit-metadata" ) )
                {
                    final PersistenceUnitMetadata e =
                        JAXB.unmarshal( new DOMSource( c.element ), PersistenceUnitMetadata.class );

                    orm.setPersistenceUnitMetadata( e );
                    acknowledge = true;
                }
View Full Code Here

Examples of org.datanucleus.metadata.PersistenceUnitMetaData

        Map props = new HashMap();
        try
        {
            // Try extracting properties from persistence-unit
            NucleusContext nucCtx = new NucleusContext("JDO", null); // Do we need JDO here?
            PersistenceUnitMetaData pumd = nucCtx.getMetaDataManager().getMetaDataForPersistenceUnit(factory);
            props.putAll(pumd.getProperties());
        }
        catch (Exception e)
        {
            LOGGER_REST.error("Exception with persistence-unit ", e);
            // TODO Try extracting properties from jdoconfig
View Full Code Here

Examples of org.datanucleus.metadata.PersistenceUnitMetaData

            }
            else if (localName.equals("persistence-unit"))
            {
                // New "persistence-unit"
                PersistenceFileMetaData filemd = (PersistenceFileMetaData)getStack();
                PersistenceUnitMetaData pumd = new PersistenceUnitMetaData(getAttr(attrs, "name"),
                    getAttr(attrs, "transaction-type"), rootURI);
                filemd.addPersistenceUnit(pumd);
                pushStack(pumd);
            }
            else if (localName.equals("properties"))
            {
                // Do nothing
            }
            else if (localName.equals("property"))
            {
                // New "property" for the current persistence unit
                PersistenceUnitMetaData pumd = (PersistenceUnitMetaData)getStack();
                pumd.addProperty(getAttr(attrs, "name"), getAttr(attrs, "value"));
            }
            else if (localName.equals("mapping-file"))
            {
                // Processed elsewhere
            }
            else if (localName.equals("class"))
            {
                // Processed elsewhere
            }
            else if (localName.equals("jar-file"))
            {
                // Processed elsewhere
            }
            else if (localName.equals("jta-data-source"))
            {
                // Processed elsewhere
            }
            else if (localName.equals("non-jta-data-source"))
            {
                // Processed elsewhere
            }
            else if (localName.equals("description"))
            {
                // Processed elsewhere
            }
            else if (localName.equals("provider"))
            {
                // Processed elsewhere
            }
            else if (localName.equals("shared-cache-mode"))
            {
                // Processed elsewhere
            }
            else if (localName.equals("validation-mode"))
            {
                // Processed elsewhere
            }
            else if (localName.equals("exclude-unlisted-classes"))
            {
                PersistenceUnitMetaData pumd = (PersistenceUnitMetaData)getStack();
                pumd.setExcludeUnlistedClasses();
            }
            else
            {
                String message = LOCALISER.msg("044037",qName);
                NucleusLogger.METADATA.error(message);
View Full Code Here

Examples of org.datanucleus.metadata.PersistenceUnitMetaData

        NucleusContext nucleusCtx = new NucleusContext(api, startupProps);
        PersistenceConfiguration propConfig = nucleusCtx.getPersistenceConfiguration();

        // Generate list of properties for SchemaTool usage
        Map props = new HashMap();
        PersistenceUnitMetaData pumd = null;
        if (persistenceUnitName != null)
        {
            // Obtain any props defined for the persistence-unit
            props.put("javax.jdo.option.persistenceunitname", persistenceUnitName);
            pumd = nucleusCtx.getMetaDataManager().getMetaDataForPersistenceUnit(persistenceUnitName);
            if (pumd != null)
            {
                // Add the properties for the unit
                if (pumd.getProperties() != null)
                {
                    props.putAll(pumd.getProperties());
                }
            }
            else
            {
                throw new NucleusUserException("SchemaTool has been specified to use persistence-unit with name " +
                    persistenceUnitName + " but none was found with that name");
            }

            if (api.equalsIgnoreCase("JPA"))
            {
                pumd.clearJarFiles(); // Don't use JARs when in J2SE for JPA
            }
        }
        else if (userProps != null)
        {
            // Properties specified by the user in a file
View Full Code Here

Examples of org.datanucleus.metadata.PersistenceUnitMetaData

        catch (URISyntaxException e1)
        {
        }
        if (unitInfo.getTransactionType() == PersistenceUnitTransactionType.JTA)
        {
            unitMetaData = new PersistenceUnitMetaData(unitInfo.getPersistenceUnitName(),
                TransactionType.JTA.toString(), rootURI);
        }
        else if (unitInfo.getTransactionType() == PersistenceUnitTransactionType.RESOURCE_LOCAL)
        {
            unitMetaData = new PersistenceUnitMetaData(unitInfo.getPersistenceUnitName(),
                TransactionType.RESOURCE_LOCAL.toString(), rootURI);
        }
       
        // Classes
        List<String> classNames = unitInfo.getManagedClassNames();
View Full Code Here

Examples of org.datanucleus.metadata.PersistenceUnitMetaData

        nucleusContext = new NucleusContext("JDO", startupProps);

        // Generate the properties to apply to the PMF
        Map pmfProps = new HashMap();

        PersistenceUnitMetaData pumd = null;
        if (props != null)
        {
            String persistenceUnitName = (String)props.get("datanucleus.PersistenceUnitName");
            if (persistenceUnitName == null)
            {
                persistenceUnitName = (String)props.get("javax.jdo.option.PersistenceUnitName");
            }
            if (persistenceUnitName != null)
            {
                // PMF for a "persistence-unit", so add property so the persistence mechanism knows this
                getConfiguration().setProperty("datanucleus.PersistenceUnitName", persistenceUnitName);

                try
                {
                    // Obtain any props defined for the persistence-unit
                    pumd = nucleusContext.getMetaDataManager().getMetaDataForPersistenceUnit(persistenceUnitName);
                    if (pumd != null)
                    {
                        // Add the properties for the unit
                        if (pumd.getProperties() != null)
                        {
                            pmfProps.putAll(pumd.getProperties());
                        }
                    }
                    else
                    {
                        throw new JDOUserException(LOCALISER.msg("012004", persistenceUnitName));
                    }

                    if (nucleusContext.getApiName().equalsIgnoreCase("JPA"))
                    {
                        pumd.clearJarFiles(); // Don't use JARs when in J2SE for JPA
                    }
                }
                catch (NucleusException jpe)
                {
                    throw new JDOUserException(LOCALISER.msg("012005", persistenceUnitName));
View Full Code Here

Examples of org.hibernate.jpamodelgen.xml.jaxb.PersistenceUnitMetadata

   * within the entity, mapped-superclass, and embeddable elements are ignored.<li>
   * </ul>
   */
  private void determineDefaultAccessTypeAndMetaCompleteness() {
    for ( EntityMappings mappings : entityMappings ) {
      PersistenceUnitMetadata meta = mappings.getPersistenceUnitMetadata();
      if ( meta != null ) {
        if ( meta.getXmlMappingMetadataComplete() != null ) {
          context.mappingDocumentFullyXmlConfigured( true );
        }
        else {
          context.mappingDocumentFullyXmlConfigured( false );
        }

        PersistenceUnitDefaults persistenceUnitDefaults = meta.getPersistenceUnitDefaults();
        if ( persistenceUnitDefaults != null ) {
          org.hibernate.jpamodelgen.xml.jaxb.AccessType xmlAccessType = persistenceUnitDefaults.getAccess();
          if ( xmlAccessType != null ) {
            context.setPersistenceUnitDefaultAccessType( mapXmlAccessTypeToJpaAccessType( xmlAccessType ) );
          }
View Full Code Here

Examples of org.hibernate.jpamodelgen.xml.jaxb.PersistenceUnitMetadata

    if ( mappings.getAccess() != null ) {
      accessType = mapXmlAccessTypeToJpaAccessType( mappings.getAccess() );
      return accessType; // no need to check persistence unit default
    }

    PersistenceUnitMetadata meta = mappings.getPersistenceUnitMetadata();
    if ( meta != null ) {
      PersistenceUnitDefaults persistenceUnitDefaults = meta.getPersistenceUnitDefaults();
      if ( persistenceUnitDefaults != null ) {
        org.hibernate.jpamodelgen.xml.jaxb.AccessType xmlAccessType = persistenceUnitDefaults.getAccess();
        if ( xmlAccessType != null ) {
          accessType = mapXmlAccessTypeToJpaAccessType( xmlAccessType );
        }
View Full Code Here

Examples of org.hibernate.jpamodelgen.xml.jaxb.PersistenceUnitMetadata

   * within the entity, mapped-superclass, and embeddable elements are ignored.<li>
   * </ul>
   */
  private void determineDefaultAccessTypeAndMetaCompleteness() {
    for ( EntityMappings mappings : entityMappings ) {
      PersistenceUnitMetadata meta = mappings.getPersistenceUnitMetadata();
      if ( meta != null ) {
        if ( meta.getXmlMappingMetadataComplete() != null ) {
          context.setPersistenceUnitCompletelyXmlConfigured( true );
        }

        PersistenceUnitDefaults persistenceUnitDefaults = meta.getPersistenceUnitDefaults();
        if ( persistenceUnitDefaults != null ) {
          org.hibernate.jpamodelgen.xml.jaxb.AccessType xmlAccessType = persistenceUnitDefaults.getAccess();
          if ( xmlAccessType != null ) {
            context.setPersistenceUnitDefaultAccessType( mapXmlAccessTypeToJpaAccessType( xmlAccessType ) );
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.