Hi
i've been playing around with a test project consisting of
a cmp entity bean and a simple 1-method-webservice trying to persist on
instance of that entity.
deployment of the classes went well but i couldnt get an entity-instance
persisted.
the entity class look something like this
@Entity
@Table(name="SOMETABLE")
public class EntityClass implements Serializable
{
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int id;
@Column(length=100)
public String name;
int getId()
{
return id;
}
void setId(int id)
{
this.id = id;
}
String getName()
{
return name;
}
void setName(String name)
{
this.name = name;
}
}
whereas the webservice implementation is
@Stateless
@WebService(serviceName = "TestWS",
portName = "TestWSPort",
endpointInterface = "xxxx",
targetNamespace = "xxx")
public class TestWSBean implements TestWS {
@PersistenceContext(unitName="TestPU")
private EntityManager em;
public String saveName(String value)
{
String result = "ok";
try {
EntityClass b = new EntityClass();
b.setName(value);
em.persist(value);
}
catch(Exception ex) {
ex.printStackTrace();
result = ex.getLocalizedMessage() + " " +
ex.getClass().getName();
}
return result;
}
}
Calling the webservice-method from within the eclipse ws-explorer i get the
following message:
Attempt to cast instance "abc [java.lang.String]" to PersistenceCapable
failed. Ensure that it has been enhanced.
org.apache.openjpa.persistence.ArgumentException
geronimo is 2.1.3.
Kind regards
Phil
--
View this message in context:
http://www.nabble.com/CMP-exception%3A-Attempt-to-cast-instance-%22xxx--java.lang.String-%22-to-PersistenceCapable-failed.--Ensure-that-it-has-been-enhanced.-tp22436043s134p22436043.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.