users@jpa-spec.java.net

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

From: Linda DeMichiel <linda.demichiel_at_oracle.com>
Date: Mon, 17 Dec 2012 11:30:56 -0800

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.