]
Ian Darwin reopened JBSEAM-2095:
--------------------------------
Changing to a Documentation Request, and attaching the documentation I previously promised
to write.
Multiple DataSources in same EAR, hib2ddl and import.sql run on all
-------------------------------------------------------------------
Key: JBSEAM-2095
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2095
Project: JBoss Seam
Issue Type: Feature Request
Components: Core
Affects Versions: 2.0.0.CR1
Environment: EAR deployment, POJO beans setup by Seam-Gen. OS not relevant; tried
JDK1.6 and 1.7EA. DB is PostgreSQL 8.
Reporter: Ian Darwin
When using multiple DataSources in an EJB3 EAR, as suggested by Gavin the the URL
referenced below, using Hibernate as the underlying persistence, it appears that the
"schema export" and the /import.sql get applied to both.
It would be nice if there could be a more fine-grained mechanism for associating
import.sql and hbm2ddl with particular entities.
I have two Datasources, call them "all" and "bugs" (the idea being
that the bugs database will be shared by all developers and should be permanent, whereas
the "all" database should be dropped and recreated/imported
each tim).
16:07:55,345 INFO [SchemaExport] Running hbm2ddl schema export
16:07:55,345 INFO [SchemaExport] exporting generated schema to database
16:07:55,504 INFO [SchemaExport] Executing import script: /import.sql
16:07:55,568 INFO [SchemaExport] schema export complete
...
16:07:55,710 INFO [SchemaExport] Running hbm2ddl schema export
16:07:55,711 INFO [SchemaExport] exporting generated schema to database
16:07:55,857 INFO [SchemaExport] Executing import script: /import.sql
16:07:55,911 INFO [SchemaExport] schema export complete
It would be most convenient if one could specify more precisely which entities go in
which Schema.
I have added the @PersistenceContext annotation on the BugsHome class'
EntityManager:
@PersistenceUnit(name="tcpseambug")
@In EntityManager bugEntityManager;
public EntityManager getEntityManager() { return bugEntityManager; }
Note that if I disable the hbm2ddl export on the "bugs" database, then schema
setup quits when one of the tables in the "all" database shows up missing.
N.B. Will be happy to write up a complete example for the Reference Manual once this is
working :-), as there are several related questions on the Forums.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: