This content has been marked as final.
Show 7 replies
-
1. Re: @PersistenceContext is not injected..
bmajsak Apr 11, 2013 6:52 AM (in response to klind)Which container are you using? Can you also share relevant bits of POM so we can see which exact versions of Arquillian toolset are involved?
-
2. Re: @PersistenceContext is not injected..
klind Apr 11, 2013 11:40 AM (in response to bmajsak)Here is the arquillian part...
<dependency> <groupId>org.jboss.arquillian.junit</groupId> <artifactId>arquillian-junit-container</artifactId> <version>1.0.3.Final</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.container</groupId> <artifactId>arquillian-weld-ee-embedded-1.1</artifactId> <version>1.0.0.CR6</version> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.weld</groupId> <artifactId>weld-core</artifactId> <version>1.1.11.Final</version> <scope>test</scope> </dependency>
-
3. Re: @PersistenceContext is not injected..
bmajsak Apr 11, 2013 11:44 AM (in response to klind)Ok, that's the problem. Weld is not fully Java EE environment, therefore @PersistenceContext is not supported, have a look here.
-
4. Re: @PersistenceContext is not injected..
klind Apr 11, 2013 11:52 AM (in response to bmajsak)ahhh..
so I will have to do this :
private EntityManager em; @Inject private UserTransaction utx; @Deployment public static JavaArchive createDeployment() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class)// .addClass(PrintCustomerDao.class)// .addClass(OrderDao.class)// .addAsManifestResource("persistence.xml") .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); System.out.println(jar.toString(true)); return jar; } @Before public void setUp() { EntityManagerFactory f = Persistence.createEntityManagerFactory("jsi-test"); em = f.createEntityManager(); }
-
5. Re: @PersistenceContext is not injected..
bmajsak Apr 11, 2013 11:55 AM (in response to klind)Not sure if UserTransaction will be available though Why not some normal container instead? JBoss managed is ain't slow
-
6. Re: @PersistenceContext is not injected..
klind Apr 11, 2013 11:58 AM (in response to bmajsak)ya the UserTransaction was some leftover..
How would the setup look like with a JBoss managed container ?
-
7. Re: @PersistenceContext is not injected..
bmajsak Apr 11, 2013 2:15 PM (in response to klind)Please have a look at the guides we crafted http://arquillian.org/guides/
You will find it right away