0 Replies Latest reply on Dec 3, 2005 11:52 AM by Xinhua Gu

    DVD store Demo problem, need help

    Xinhua Gu Newbie

      hi,all
      a failure when i use Dataloder to load random data in database.
      In Dataloader, a catagory is set in a Product

       for(Product product: products) {
      
       product.setCategory(categories.get(random(categories.size())));
       product.setRelatedProduct(products.get(random(products.size())));
       Inventory inv = new Inventory();
       inv.setProduct(product);
       inv.setQuantity(random(500));
       product.setInventory(inv);
       }
      


      But after calling

      mgr.createProducts(products);
      


      The catagory property in product is lost!! I got a null exception when em.persist(product)

      What is the problem and how can i slove it?