[
http://jira.jboss.com/jira/browse/JBIDE-1367?page=comments#action_12389172 ]
Max Andersen commented on JBIDE-1367:
-------------------------------------
Ok - conclusions so far:
Persistence.xml:
We can only have *one* persistence.xml on the classpath since the location of this decides
which entities that will be loaded.
So if you have persistence.xm lin test Zero entities will be available.
ds.xml is only required for seam2 - and should be put in test-src/META-INF/ and test-src/
should have a seam.properties so it will be automaticlally scanned (configured by the MC
bootstrap in seamtest)
ds.xml is not require for seam1, but since we can't have custom test persistence.xml
we need to figure out how to setup the rightly named datasource in the
bootstrap/embedded.
Simplified example testcase for both seam 1 and 2 is to create seam project, New Action
(to get test), New Entity (to get an entity) add the following method to that test:
@Test
public void testPersistenceWorking() throws Exception
{
new FacesRequest() {
@Override
protected void invokeApplication() throws Exception
{
EntityManagerFactory pc = (EntityManagerFactory)
getValue("#{<projectname>EntityManagerFactory}");
assert pc!=null;
EntityManager em = pc.createEntityManager();
Session s = (Session) em.getDelegate();
System.out.println(s.getSessionFactory());
System.out.println("everyone: " + s.createQuery("from
java.lang.Object").list());
s.persist(new TheEntityYouCreated());
}
}.run();
}
That should test the persistence.xml and availability of proper ds.xml
double ds.xml in Seam War project
---------------------------------
Key: JBIDE-1367
URL:
http://jira.jboss.com/jira/browse/JBIDE-1367
Project: JBoss Tools
Issue Type: Bug
Components: Seam
Affects Versions: 2.0.0.CR1
Reporter: Max Andersen
Assigned To: Max Andersen
Priority: Blocker
Fix For: 2.0.0.GA
ds.xml ends up in both resources/ds.xml and in src/model/web-inf/ds.xml
only one of them should be enough.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira