01: /*
02: $Header: /cvsroot/xorm/xorm/examples/src/org/xorm/examples/books/Application.java,v 1.5 2002/04/28 00:34:31 wbiggs Exp $
03:
04: This file is part of XORM.
05:
06: XORM is free software; you can redistribute it and/or modify
07: it under the terms of the GNU General Public License as published by
08: the Free Software Foundation; either version 2 of the License, or
09: (at your option) any later version.
10:
11: XORM is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: GNU General Public License for more details.
15:
16: You should have received a copy of the GNU General Public License
17: along with Foobar; if not, write to the Free Software
18: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20: package org.xorm.examples.books;
21:
22: import java.util.*;
23: import javax.jdo.*;
24: import org.xorm.XORM;
25:
26: public class Application {
27: public static void main(String[] argv) {
28: PersistenceManagerFactory factory = XORM
29: .newPersistenceManagerFactory();
30: PersistenceManager mgr = factory.getPersistenceManager();
31:
32: Transaction txn = mgr.currentTransaction();
33: txn.begin();
34:
35: Person owner = (Person) XORM.newInstance(mgr, Person.class);
36: owner.setFirstName("Wes");
37: owner.setLastName("Biggs");
38:
39: Library library = (Library) XORM
40: .newInstance(mgr, Library.class);
41: library.setOwner(owner);
42: mgr.makePersistent(library);
43:
44: txn.commit();
45: }
46: }
|