Thanks for the pointer.
Based on what I saw in the spec (after a very quick scan) I have implemented it
as follows (assuming that the trySeam1Entity has been configured in my
persistence.xml):
| public class BeginWithFactoryTestNG {
|
| private static EntityManagerFactory emf = null;
| public EntityManagerFactory getEntityManagerFactory() {
| if (emf == null) {
| emf =
Persistence.createEntityManagerFactory("trySeam1Entity");
| }
|
| return emf;
| }
| @Test
| public void testPersist() {
|
| EntityManager em =
getEntityManagerFactory().createEntityManager();
| assert em != null;
| FElement fe = new FElement();
| fe.setValue("Gavin is King ;-)");
| em.getTransaction().begin();
| em.persist(fe);
| em.flush();
| em.getTransaction().commit();
| em.close();
| }
| @Test
| public void testRetrieve() {
| EntityManager em =
getEntityManagerFactory().createEntityManager();
| .
| .
| }
|
| }
Seems to work OK, so hopefully I haven't missed the bus completely !
Thanks
Louis
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3918154#3918154
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3918154
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user