[jboss-user] [EJB 3.0] - failed to deploy entity when persistence.xml is there
peiguo
do-not-reply at jboss.com
Sun Apr 27 13:12:51 EDT 2008
I am trying out persistence and EJB 3, but I got this error when the jar is deployed:
| 10:06:55,887 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
|
| --- MBeans waiting for other MBeans ---
| ObjectName: jboss.j2ee:jar=order.jar,name=ShoppingCartBean,service=EJB3
| State: NOTYETINSTALLED
| I Depend On:
| persistence.units:unitName=sample
|
| --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
| ObjectName: persistence.units:unitName=sample
| State: NOTYETINSTALLED
| Depends On Me:
| jboss.j2ee:jar=order.jar,name=ShoppingCartBean,service=EJB3
|
I do have a persistencein META-INF directory:
| <persistence 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_1_0.xsd"
| version="1.0">
| <persistence-unit name="sample">
| <jta-data-source>java:/DefaultDS</jta-data-source>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| </properties>
| </persistence-unit>
| </persistence>
|
in my stateful bean I have this code:
| package org.jboss.tutorial.entity.bean;
|
| import javax.ejb.Remote;
| import javax.ejb.Remove;
| import javax.ejb.Stateful;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import javax.persistence.PersistenceContext;
|
|
| @Stateful
| @Remote(ShoppingCart.class)
| public class ShoppingCartBean implements ShoppingCart, java.io.Serializable
| {
| @PersistenceContext(unitName="sample")
| private EntityManager manager;
| private Order order;
|
| public void buy(String product, int quantity, double price)
| {
| if (order == null) order = new Order();
| order.addPurchase(product, quantity, price);
| }
|
| public Order getOrder()
| {
| return order;
| }
|
| @Remove
| public void checkout()
| {
| manager.persist(order);
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4147072#4147072
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4147072
More information about the jboss-user
mailing list