Example usage for org.hibernate.cfg EJB3DTDEntityResolver EJB3DTDEntityResolver

List of usage examples for org.hibernate.cfg EJB3DTDEntityResolver EJB3DTDEntityResolver

Introduction

In this page you can find the example usage for org.hibernate.cfg EJB3DTDEntityResolver EJB3DTDEntityResolver.

Prototype

EJB3DTDEntityResolver

Source Link

Usage

From source file:org.jboss.ejb3.Ejb3Deployment.java

License:Open Source License

protected void initializePersistenceUnits() throws Exception {
    URL persistenceXmlUrl = null;
    persistenceXmlUrl = di.getPersistenceXml();

    hasEntities = persistenceXmlUrl != null;

    if (!hasEntities)
        return;/*w  w  w .  j a va2s  .  c o m*/

    if (di.getClasses() != null) {
        for (Class explicit : di.getClasses()) {
            if (explicit.isAnnotationPresent(Entity.class)) {
                explicitEntityClasses.add(explicit.getName());
            }
        }
    }

    // scope the unitName if this is an ejb archive
    List<PersistenceMetadata> persistenceMetadata = PersistenceXmlLoader.deploy(persistenceXmlUrl,
            new HashMap(), new EJB3DTDEntityResolver());
    for (PersistenceMetadata metadata : persistenceMetadata) {
        String earShortName = ear == null ? null : ear.getShortName();
        boolean isScoped = ejbContainers.size() > 0;
        PersistenceUnitDeployment deployment = new PersistenceUnitDeployment(initialContext, this,
                explicitEntityClasses, persistenceXmlUrl, metadata, earShortName, di.getShortName(), isScoped);
        PersistenceUnitRegistry.register(deployment);
        persistenceUnitDeployments.add(deployment);
    }
}