Hi

Here a sample project:

.
├── pom.xml
├── src
│   ├── main
│   │   ├── java
│   │   │   └── org
│   │   │       └── foo
│   │   │           ├── API.java
│   │   │           └── App.java
│   │   ├── resources
│   │   └── webapp
│   │       └── WEB-INF
│   │           └── persistence.xml


package org.foo;

import javax.jws.WebService;

@WebService
public interface API {
String hello();
}


package org.foo;

import javax.ejb.Stateless;
import javax.jws.WebService;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
@WebService
public class App implements API {
@PersistenceContext
private EntityManager em;

public String hello() {
return "Hello, " + em.toString();
}
}

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
 xmlns="http://java.sun.com/xml/ns/persistence";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence

http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
<persistence-unit name="user">
 <jta-data-source>My DataSource</jta-data-source>
<non-jta-data-source>My Unmanaged DataSource</non-jta-data-source>
 <properties>
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
 </properties>
</persistence-unit>
</persistence>


And it works. Which version so you use? Can you share a sample showing it
doesn't work?



Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-05-28 14:23 GMT+02:00 racarlson <[email protected]>:

> tomee doesn't inject entityManager exposed as @WebService when called thru
> soap. I tested calling the @Stateless ejb as a remote ejb call and
> everything works - entityManager is injected. However if you call it as
> soap
> webservice the entity manager doesn't get injected. This is a major issue
> as
> one would need to use another container or have code to check if auto
> injected and if not create entity manager and likely handle transactions
> manually
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/tomee-doesn-t-inject-entityManager-exposed-as-WebService-when-called-thru-soap-tp4669705.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Reply via email to