Hi Klaus,
In GlassFish there is an option to drop and create tables for the Toplink
Essentials as the JPA provider at application deploy (and drop tables on
undeploy) time. See GlassFish developer guide for the details:
http://docs.sun.com/app/docs/doc/819-3672/gbwlh?a=view
Regards,
-marina
Klaus Unger wrote:
> Hi,
>
> I want to use Toplinks EntityManagerFactoryProvider.DDL_GENERATION feature in
> a safe way.
>
> I used to use
> Persistence.createEntityManagerFactory(...) / emf.createEntityManager();
> however this way I cannot use a jta-data-source (I guess because this EM is
> not containermanaged).
>
> So I wanted to move this to a SessionBean getting a EM injected by:
>
> @PersistenceContext(type=PersistenceContextType.EXTENDED, properties={
> @PersistenceProperty(name=EntityManagerFactoryProvider.DDL_GENERATION,
> value=EntityManagerFactoryProvider.DROP_AND_CREATE)
> })
>
> However I feel queasy about this because I totally loose control over the time
> of execution and I see no way to synchronize this at all. The only place I
> see to do at least some preparations is the SessionBean constructor.
>
> Is there any good way to do this?
>
> Best Regards
> Klaus