Source Code Cross Referenced for MultiReference.java in  » Database-ORM » tro-community-7.2-1 » allinone » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » tro community 7.2 1 » allinone 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package allinone;
002:
003:        import com.lutris.appserver.server.sql.*;
004:        import com.lutris.util.*;
005:        import org.enhydra.dods.*;
006:        import java.sql.SQLException;
007:
008:        import javax.swing.*;
009:        import java.util.*;
010:        import java.awt.*;
011:        import java.awt.event.*;
012:        import java.net.*;
013:        import java.io.*;
014:        import org.apache.log4j.Logger;
015:        import org.apache.log4j.xml.DOMConfigurator;
016:        import com.lutris.appserver.server.sql.*;
017:        import allinone.data.tableA.*;
018:        import allinone.data.tableB.*;
019:        import allinone.data.tableC.*;
020:        import allinone.data.tableD.*;
021:
022:        public class MultiReference {
023:            void showTables(DBTransaction dbTrans) {
024:                try {
025:                    NDCTableAQuery queryA = new NDCTableAQuery(dbTrans);
026:                    NDCTableADO[] allADO = queryA.getDOArray();
027:                    System.err.println();
028:                    System.err
029:                            .println("-------------TableA-----begin----------");
030:                    if (allADO != null) {
031:                        if (allADO.length > 0)
032:                            System.err
033:                                    .println("---oid------someData------refToC---refToD-----");
034:                        for (int i = 0; i < allADO.length; i++) {
035:                            System.err.print("   " + allADO[i].getHandle());
036:                            System.err.print("   " + allADO[i].getSomedata());
037:                            System.err
038:                                    .print("   "
039:                                            + (null != allADO[i].getReftoc() ? allADO[i]
040:                                                    .getReftoc().getHandle()
041:                                                    : "null"));
042:                            System.err
043:                                    .print("   "
044:                                            + (null != allADO[i].getReftob() ? allADO[i]
045:                                                    .getReftob().getHandle()
046:                                                    : "null"));
047:                            System.err.println();
048:                        }
049:                    } else {
050:                        System.err.println("noData");
051:                    }
052:                    System.err
053:                            .println("-------------TableA-----end------------");
054:
055:                    NDCTableBQuery queryB = new NDCTableBQuery(dbTrans);
056:                    NDCTableBDO[] allBDO = queryB.getDOArray();
057:                    System.err.println();
058:                    System.err
059:                            .println("-------------TableB-----begin----------");
060:                    if (allBDO != null) {
061:                        if (allBDO.length > 0)
062:                            System.err
063:                                    .println("---oid------someData------refToD-----");
064:                        for (int i = 0; i < allBDO.length; i++) {
065:                            System.err.print("   " + allBDO[i].getHandle());
066:                            System.err.print("   " + allBDO[i].getSomedata());
067:                            System.err
068:                                    .print("   "
069:                                            + (null != allBDO[i].getReftod() ? allBDO[i]
070:                                                    .getReftod().getHandle()
071:                                                    : "null"));
072:                            System.err.println();
073:                        }
074:                    } else {
075:                        System.err.println("noData");
076:                    }
077:                    System.err
078:                            .println("-------------TableB-----end------------");
079:
080:                    NDCTableCQuery queryC = new NDCTableCQuery(dbTrans);
081:                    NDCTableCDO[] allCDO = queryC.getDOArray();
082:                    System.err.println();
083:                    System.err
084:                            .println("-------------TableC-----begin----------");
085:                    if (allCDO != null) {
086:                        if (allCDO.length > 0)
087:                            System.err
088:                                    .println("---oid------someData------refToD-----");
089:                        for (int i = 0; i < allCDO.length; i++) {
090:                            System.err.print("   " + allCDO[i].getHandle());
091:                            System.err.print("   " + allCDO[i].getSomedata());
092:                            System.err
093:                                    .print("   "
094:                                            + (null != allCDO[i].getReftod() ? allCDO[i]
095:                                                    .getReftod().getHandle()
096:                                                    : "null"));
097:                            System.err.println();
098:                        }
099:                    } else {
100:                        System.err.println("noData");
101:                    }
102:                    System.err
103:                            .println("-------------TableC-----end------------");
104:
105:                    NDCTableDQuery queryD = new NDCTableDQuery(dbTrans);
106:                    NDCTableDDO[] allDDO = queryD.getDOArray();
107:                    System.err.println();
108:                    System.err
109:                            .println("-------------TableD-----begin----------");
110:                    if (allDDO != null) {
111:                        if (allDDO.length > 0)
112:                            System.err.println("---oid------someData--------");
113:                        for (int i = 0; i < allDDO.length; i++) {
114:                            System.err.print("   " + allDDO[i].getHandle());
115:                            System.err.print("   " + allDDO[i].getSomedata());
116:                            System.err.println();
117:                        }
118:                    } else {
119:                        System.err.println("noData");
120:                    }
121:                    System.err
122:                            .println("-------------TableD-----end------------");
123:                } catch (Exception e) {
124:                    e.printStackTrace();
125:                }
126:            }
127:
128:            public void runTest(DBTransaction dbTrans1) {
129:                try {
130:                    boolean autoWrite = ((StandardDatabaseManager) DODS
131:                            .getDatabaseManager())
132:                            .getDatabaseManagerConfiguration().getAutoWrite();
133:                    System.err
134:                            .println("___ - + * startin MultRef with unDelete * + -  ___");
135:                    showTables(dbTrans1);
136:
137:                    NDCTableDDO tableD1 = NDCTableDDO.createVirgin(dbTrans1);
138:                    tableD1.setSomedata("tableD1");
139:                    tableD1.save();
140:                    NDCTableDDO tableD2 = NDCTableDDO.createVirgin(dbTrans1);
141:                    tableD2.setSomedata("tableD2");
142:                    tableD2.save();
143:                    NDCTableDDO tableD3 = NDCTableDDO.createVirgin(dbTrans1);
144:                    tableD3.setSomedata("tableD3");
145:                    tableD3.save();
146:                    NDCTableDDO tableD4 = NDCTableDDO.createVirgin(dbTrans1);
147:                    tableD4.setSomedata("tableD4");
148:                    tableD4.save();
149:                    NDCTableDDO tableD5 = NDCTableDDO.createVirgin(dbTrans1);
150:                    tableD5.setSomedata("tableD5");
151:                    tableD5.save();
152:                    NDCTableDDO tableD6 = NDCTableDDO.createVirgin(dbTrans1);
153:                    tableD6.setSomedata("tableD6");
154:                    tableD6.save();
155:                    if (!autoWrite)
156:                        dbTrans1.write();
157:
158:                    NDCTableCDO tableC1 = NDCTableCDO.createVirgin(dbTrans1);
159:                    tableC1.setSomedata("tableC1");
160:                    tableC1.setReftod(tableD1);
161:                    tableC1.save();
162:                    NDCTableCDO tableC2 = NDCTableCDO.createVirgin(dbTrans1);
163:                    tableC2.setSomedata("tableC2");
164:                    tableC2.setReftod(tableD2);
165:                    tableC2.save();
166:                    NDCTableCDO tableC3 = NDCTableCDO.createVirgin(dbTrans1);
167:                    tableC3.setSomedata("tableC3");
168:                    tableC3.setReftod(tableD3);
169:                    tableC3.save();
170:                    NDCTableCDO tableC4 = NDCTableCDO.createVirgin(dbTrans1);
171:                    tableC4.setSomedata("tableC4");
172:                    tableC4.setReftod(tableD4);
173:                    tableC4.save();
174:                    NDCTableCDO tableC5 = NDCTableCDO.createVirgin(dbTrans1);
175:                    tableC5.setSomedata("tableC5");
176:                    tableC5.setReftod(tableD5);
177:                    tableC5.save();
178:                    NDCTableCDO tableC6 = NDCTableCDO.createVirgin(dbTrans1);
179:                    tableC6.setSomedata("tableC6");
180:                    tableC6.setReftod(tableD6);
181:                    tableC6.save();
182:                    if (!autoWrite)
183:                        dbTrans1.write();
184:
185:                    NDCTableBDO tableB1 = NDCTableBDO.createVirgin(dbTrans1);
186:                    tableB1.setSomedata("tableB1");
187:                    tableB1.setReftod(tableD1);
188:                    tableB1.save();
189:                    NDCTableBDO tableB2 = NDCTableBDO.createVirgin(dbTrans1);
190:                    tableB2.setSomedata("tableB2");
191:                    tableB2.setReftod(tableD2);
192:                    tableB2.save();
193:                    NDCTableBDO tableB3 = NDCTableBDO.createVirgin(dbTrans1);
194:                    tableB3.setSomedata("tableB3");
195:                    tableB3.setReftod(tableD3);
196:                    tableB3.save();
197:                    NDCTableBDO tableB4 = NDCTableBDO.createVirgin(dbTrans1);
198:                    tableB4.setSomedata("tableB4");
199:                    tableB4.setReftod(tableD4);
200:                    tableB4.save();
201:                    NDCTableBDO tableB5 = NDCTableBDO.createVirgin(dbTrans1);
202:                    tableB5.setSomedata("tableB5");
203:                    tableB5.setReftod(tableD5);
204:                    tableB5.save();
205:                    NDCTableBDO tableB6 = NDCTableBDO.createVirgin(dbTrans1);
206:                    tableB6.setSomedata("tableB6");
207:                    tableB6.setReftod(tableD6);
208:                    tableB6.save();
209:                    if (!autoWrite)
210:                        dbTrans1.write();
211:
212:                    NDCTableADO tableA1 = NDCTableADO.createVirgin(dbTrans1);
213:                    tableA1.setSomedata("tableA1");
214:                    tableA1.setReftob(tableB1);
215:                    tableA1.setReftoc(tableC1);
216:                    tableA1.save();
217:                    NDCTableADO tableA2 = NDCTableADO.createVirgin(dbTrans1);
218:                    tableA2.setSomedata("tableA2");
219:                    tableA2.setReftob(tableB2);
220:                    tableA2.setReftoc(tableC2);
221:                    tableA2.save();
222:                    NDCTableADO tableA3 = NDCTableADO.createVirgin(dbTrans1);
223:                    tableA3.setSomedata("tableA3");
224:                    tableA3.setReftob(tableB3);
225:                    tableA3.setReftoc(tableC3);
226:                    tableA3.save();
227:                    NDCTableADO tableA4 = NDCTableADO.createVirgin(dbTrans1);
228:                    tableA4.setSomedata("tableA4");
229:                    tableA4.setReftob(tableB4);
230:                    tableA4.setReftoc(tableC4);
231:                    tableA4.save();
232:                    NDCTableADO tableA5 = NDCTableADO.createVirgin(dbTrans1);
233:                    tableA5.setSomedata("tableA5");
234:                    tableA5.setReftob(tableB5);
235:                    tableA5.setReftoc(tableC5);
236:                    tableA5.save();
237:                    NDCTableADO tableA6 = NDCTableADO.createVirgin(dbTrans1);
238:                    tableA6.setSomedata("tableA6");
239:                    tableA6.setReftob(tableB6);
240:                    tableA6.setReftoc(tableC6);
241:                    tableA6.save();
242:                    if (!autoWrite)
243:                        dbTrans1.write();
244:                    dbTrans1.commit();
245:                    //dbTrans1.release();
246:                    //dbTrans1 = DODS.getDatabaseManager().createTransaction();
247:
248:                    System.err.println("rows inserted");
249:                    showTables(dbTrans1);
250:
251:                    System.err.print("delete1 --- ");
252:                    tableD1.delete();
253:                    System.err.print("delete2 --- ");
254:                    tableD2.delete();
255:                    System.err.print("delete3 --- ");
256:                    tableD3.delete();
257:                    System.err.print("delete4 --- ");
258:                    tableD4.delete();
259:                    System.err.print("delete5 --- ");
260:                    tableD5.delete();
261:                    System.err.println("delete6 ---");
262:                    tableD6.delete();
263:                    if (!autoWrite)
264:                        dbTrans1.write();
265:
266:                    showTables(dbTrans1);
267:
268:                    System.err.print("unDelete1 --- ");
269:                    tableD1.unDelete();
270:                    System.err.println("newD1:" + tableD1.getHandle());
271:                    System.err.print("unDelete2 --- ");
272:                    tableD2.unDelete();
273:                    System.err.println("newD2:" + tableD2.getHandle());
274:                    if (!autoWrite)
275:                        dbTrans1.write();
276:
277:                    System.err
278:                            .println("after undelete there are two D's, aren't they?");
279:                    showTables(dbTrans1);
280:
281:                    tableD1.delete();
282:                    tableD2.delete();
283:
284:                    if (null != dbTrans1)
285:                        dbTrans1.commit();
286:                    System.err
287:                            .println("that's all folks, table are empty now, I hope :) ");
288:                    showTables(dbTrans1);
289:                } catch (Exception ex) {
290:                    System.err.println(ex.toString());
291:                    ex.printStackTrace();
292:                }
293:            }
294:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.