| /******************************************************************************* |
| * Copyright (c) 2013 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: |
| * dclarke - initial |
| ******************************************************************************/ |
| package example; |
| |
| import org.eclipse.persistence.script.EntityType; |
| import org.eclipse.persistence.script.PersistenceUnit; |
| |
| public class CreateDataService { |
| |
| public static void create(String name) { |
| PersistenceUnit pu = new PersistenceUnit(name); |
| |
| pu.setDataSource("java:app/env/DS"); |
| |
| EntityType person = pu.addType("Person", "D_PERSON"); |
| person.generatedId("id"); |
| person.basic("name", String.class, "NAME"); |
| |
| EntityType address = pu.addType("Address", "D_Address"); |
| address.generatedId("id"); |
| address.basic("street", String.class, "NAME"); |
| |
| pu.create("v1.0"); |
| } |
| |
| } |