Package com.avaje.tests.insert

Source Code of com.avaje.tests.insert.TestInsertOnStringKey

package com.avaje.tests.insert;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import org.junit.Test;

import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.Ebean;
import com.avaje.tests.model.orderentity.OrderEntity;
import com.avaje.tests.model.orderentity.OrderItemEntity;

public class TestInsertOnStringKey extends BaseTestCase {

  @Test
  public void test() {
   
   
    OrderEntity orderEntity = new OrderEntity();
    orderEntity.setId("anyOrderId");
   
    OrderItemEntity orderItemEntity = new OrderItemEntity();
    orderItemEntity.setId("anyOrderItemId");
    orderItemEntity.setVariantId("anyVariantId");
    orderItemEntity.setAmount(BigDecimal.ONE);
   
    orderEntity.setItems(toList(orderItemEntity));
   
    Ebean.save(orderEntity);
   
  }

  private List<OrderItemEntity> toList(OrderItemEntity orderItemEntity) {
    List<OrderItemEntity> list = new ArrayList<OrderItemEntity>();
    list.add(orderItemEntity);
    return list;
  }
 
}
TOP

Related Classes of com.avaje.tests.insert.TestInsertOnStringKey

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.