01: package allinone;
02:
03: import com.lutris.appserver.server.sql.*;
04: import com.lutris.util.*;
05: import org.enhydra.dods.*;
06: import java.sql.SQLException;
07:
08: import javax.swing.*;
09: import java.util.*;
10: import java.awt.*;
11: import java.awt.event.*;
12: import java.net.*;
13: import java.io.*;
14: import org.apache.log4j.Logger;
15: import org.apache.log4j.xml.DOMConfigurator;
16: import com.lutris.appserver.server.sql.*;
17: import allinone.data.disc.*;
18: import allinone.data.person.*;
19:
20: public class GetDOs {
21:
22: public void runTest(DBTransaction dbTrans1) {
23: try {
24: System.err
25: .println("___ - + * startin GetDOArray * + - ___");
26: PersonDO person1 = PersonDO.createVirgin(dbTrans1);
27:
28: person1.setFirstname("Person1Name");
29: person1.setLastname("Person1LastName");
30: person1.setLogin("p1");
31: person1.setPassword("p1");
32: person1.save(dbTrans1);
33: dbTrans1.write();
34: dbTrans1.commit();
35: // System.err.println("-----person1------");
36: // System.err.println(person1);
37: // System.err.println("------------------");
38:
39: DiscDO[] discs = person1.getDiscDOArray();
40: System.err.println("DUZINA:" + discs.length);
41:
42: DiscDO disc1 = DiscDO.createVirgin(dbTrans1);
43: disc1.setArtist("Artist1");
44: disc1.setTitle("Disc test1");
45: disc1.setGenre("pop1");
46: disc1.setOwner(person1);
47: disc1.setIsLiked(false);
48: disc1.save(dbTrans1);
49:
50: disc1 = DiscDO.createVirgin(dbTrans1);
51: disc1.setArtist("Artist2");
52: disc1.setTitle("Disc test2");
53: disc1.setGenre("pop2");
54: disc1.setOwner(person1);
55: disc1.setIsLiked(false);
56: disc1.save(dbTrans1);
57:
58: String temp = person1.getHandle();
59: dbTrans1.commit();
60: dbTrans1.release();
61:
62: DBTransaction dbTrans2 = DODS.getDatabaseManager()
63: .createTransaction();
64: PersonDO pers2 = PersonDO.createExisting(temp);
65:
66: discs = pers2.getDiscDOArray();
67: System.err.println("DUZINA:" + discs.length);
68: for (int i = 0; i < discs.length; ++i) {
69: System.err.println("---disc" + i + "---\n" + discs[i]
70: + "\n------------");
71: }
72:
73: dbTrans2.commit();
74: dbTrans2.release();
75: } catch (Exception ex) {
76: System.err.println(ex.toString());
77: ex.printStackTrace();
78: }
79: }
80: }
|