If create a custom DataSource based on the built-in JPA functionality, subclass
com.isomorphic.jpa.JPA2DataSource.

JPA configuration

JPA configuration should be specified in the persistence.xml file as usual, and
placed
in the /WEB-INF/classes/META-INF directory. For JPA 2.0 make sure you correctly
declare its usage in persistence.xml:

JPADataSource supports automatic handling of JPA relations that don't declare a concrete
field to hold ID values - see JpaHibernateRelations.

JPA 1.0 compatibility

To use JPA 1.0, set serverType="jpa1" instead. JPA 1.0 does not support
DataSource.autoDeriveSchema. For JPA 1.0, the concrete implementation class (for subclassing
to
create a custom DataSource) is com.isomorphic.jpa.JPADataSource.

JPA transactions

JPA provides three mechanisms for transactions: for JEE applications JPA provides integration
with JTA (Bean Managed Transactions and Container Managed Transactions); for JSE applications
JPA has a native
EntityTransaction implementation (Locally Managed Transactions). Spring framework
is another popular
way for declaring transactions in application.
The transaction mechanism should be configured in the server.properties
file by setting
property jpa.emfProvider to the fully qualified class name of the provider
(implementation of com.isomorphic.jpa.EMFProviderInterface). Smart GWT comes
with five implementations:

com.isomorphic.jpa.EMFProviderLMT - for Locally Managed Transactions.
Every fetch or DML operation starts a new transaction and commits after successful
execution.
This implementation reads the jpa.persistenceUnitName property from
the server.properties file. The value of
this property needs
to be set to
the name of the persistence unit configured in persistence.xml file. For
example:

jpa.persistenceUnitName: PERSISTENCE_UNIT_NAME

com.isomorphic.jpa.EMFProviderBMT - for Bean Managed Transactions.
Every fetch or DML operation acquires the transaction object from the container and starts
it.
This implementation reads two properties from the server.properties
file:
jpa.entityManager and jpa.entityManagerFactory
containing appropriate resource name references configured in
/WEB-INF/web.xml. Configuration example:

com.isomorphic.jpa.EMFProviderCMT - for Container Managed Transactions.
Every fetch or DML operation acquires the transaction object from the JEE container.
After successful method execution the container commits the transaction. In case of execution
failure tx.setRollbackOnly() is used to notify container to rollback the
transaction.
This implementation reads two properties from the server.properties
file:
jpa.entityManager and jpa.entityManagerFactory
containing appropriate resource name references configured in
/META-INF/ejb-jar.xml. Configuration example:

com.isomorphic.jpa.EMFProviderNoTransactions - transactions are
not used.
From the server.properties file this
implementation reads the
jpa.persistenceUnitName property which must containt the name of
persistence unit
configured in persistence.xml file. For example:

You can set jpa.emfProvider to your own implementation of
com.isomorphic.jpa.EMFProviderInterface if you have specific requirements for
transaction handling. EMF will instantiate provided implementation on
initialization (static) and
will use same instance every time. By using own implementation you can have complete control
over creating/using
EntityManagerFactory and EntityManager instances.

Additional configurations:

In case you have several persistence units defined in your persistence.xml you can
have additional
configurations in server.properties file.
Additional configurations
(prefixed with jpa.) should have name, emfProvider
property and other
properties required by specified EMF provider implementation.
For example:

JPAConnectionHolder instance contains references to entity manager and transaction
object
used by JPADataSource. You should never commit/rollback automatic transaction.
Overall commit/rollback will be issued by RPCManager and will be handled by
JPADataSource
object which started transaction.

Inbound DSRequest data will use numeric field types from your bean

For fields with numeric types, the record
data in DSRequests will automatically
be converted to the type of the target field, before the request is received in a DMI. For
details, see DsRequestBeanTypes.