2 Replies Latest reply on Apr 27, 2008 7:37 PM by Peter Pei Guo

    Hypersonic data are all erased after jboss is restarted

    Peter Pei Guo Newbie

      The following code does persist data (orders and order lines) to database, and I did see that. The problem is that the data were all erased once jboss is restarted. How can I change that?

      I have a persistencein META-INF directory:

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
       xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
       <persistence-unit name="sample">
       <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
       <property name="hibernate.hbm2ddl.auto" value="create-drop"/>

      in my stateful bean I have this code, and checkout was called from outside:
      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;
      public class ShoppingCartBean implements ShoppingCart, java.io.Serializable
       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;
       public void checkout()