users@jpa-spec.java.net

[jpa-spec users] [jsr338-experts] Re: generateSchema method contract for Java SE environments

From: Emmanuel Bernard <ebernard_at_redhat.com>
Date: Tue, 18 Dec 2012 11:25:02 +0100

A bit late :)

This looks good. It stresses the fact that deployments will be
slower in JPA 2.1 vs JPA 2 if the container controls the database object
creation. But if I am right, that's going to be a rare case.

Emmanuel

On Mon 2012-12-17 11:30, Linda DeMichiel wrote:
> Gordon has pointed out to me that for the PersistenceProvider generateSchema method that
> is used in Java SE environments, we need to make use of a bootstrap contract much like
> the one for createEntityManagerFactory, as described in section 9.2.
>
> I therefore plan to add the following as a subsection to 9.2 to cover this.
> Please let me know if you see any problems.
>
> thanks,
>
> -Linda
>
>
> Schema Generation [inserted as a subsection of 9.2]
>
> In Java SE environments, the Persistence.generateSchema method may
> be used by the application to cause schema generation to occur as a
> separate phase from entity manager factory creation.
>
> In this case, the Persistence bootstap class must locate all of the
> persistence providers using the PersistenceProviderResolver mechanism
> described in section 9.3 and call generateSchema on them in turn until
> an appropriate backing provider returns true. A provider may deem
> itself as appropriate for the persistence unit if any of the following
> are true:
>
> Its implementation class has been specified in the provider element
> for that persistence unit in the persistence.xml file and has not been
> overridden by a different javax.persistence.provider property value
> included in the Map passed to the generateSchema method.
>
> The javax.persistence.provider property was included in the Map passed
> to generateSchema and the value of the property is the provider's
> implementation class.
>
> No provider was specified for the persistence unit in either the
> persistence.xml or the property map.
>
> If a provider does not qualify as the provider for the named
> persistence unit, it must return false when generateSchema is invoked
> on it.