blob: 08642e21051042984276988f70795ef0c7855ff5 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Oracle - initial impl
******************************************************************************/
package example;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import model.Order;
/**
* Test the performance of reading an Order object model.
* @author James Sutherland
*/
public class FindTest extends Test {
public static void main(String[] args) throws Exception {
try {
FindTest test = new FindTest();
test.setup();
test.test();
} catch (Exception error) {
error.printStackTrace();
}
System.exit(0);
}
public void runTest(EntityManagerFactory factory) {
EntityManager em = factory.createEntityManager();
int index = this.random.nextInt(this.orderIds.length);
Order order = em.find(Order.class, this.orderIds[index]);
order.getCustomer().toString();
order.getOrderLines().size();
em.close();
}
}