use of org.eclipse.persistence.internal.sessions.DatabaseSessionImpl in project eclipselink by eclipse-ee4j.
the class RCMDistributedServer method run.
/**
* This method starts the server and makes the dispatcher available
* Creation date: (7/21/00 9:58:37 AM)
*/
@Override
public void run() {
RemoteCommandManager cm = new RemoteCommandManager((AbstractSession) session);
// set propagate command synchronously for testing
cm.setShouldPropagateAsynchronously(false);
cm.getDiscoveryManager().setAnnouncementDelay(0);
// ovewrite default to use RMI registry naming service
cm.getTransportManager().setNamingServiceType(TransportManager.REGISTRY_NAMING_SERVICE);
// set full rmi URL of local host
cm.setUrl("rmi://localhost:1099");
// turn on cache sync with RCM
((AbstractSession) session).setShouldPropagateChanges(true);
cm.setServerPlatform(new NoServerPlatform(new DatabaseSessionImpl()));
cm.initialize();
}
use of org.eclipse.persistence.internal.sessions.DatabaseSessionImpl in project eclipselink by eclipse-ee4j.
the class MultipleClientBrokersTestModel method createTables.
/**
* This method was created in VisualAge.
*/
public void createTables() {
SessionBroker broker = new SessionBroker();
DatabaseSession session1 = new DatabaseSessionImpl(Server.getLogin1());
DatabaseSession session2 = new DatabaseSessionImpl(Server.getLogin2());
session1.addDescriptors(new EmployeeProject1());
session2.addDescriptors(new EmployeeProject2());
broker.registerSession("broker1", session1);
broker.registerSession("broker2", session2);
broker.setLogLevel(getSession().getLogLevel());
broker.setLog(getSession().getLog());
broker.login();
// Set session for join table.
((ManyToManyMapping) session1.getDescriptor(Employee.class).getObjectBuilder().getMappingForAttributeName("projects")).setSessionName("broker2");
// Disable delete verify.
((OneToOneMapping) session1.getDescriptor(Employee.class).getObjectBuilder().getMappingForAttributeName("address")).setShouldVerifyDelete(false);
org.eclipse.persistence.testing.models.employee.relational.EmployeeTableCreator tables = new org.eclipse.persistence.testing.models.employee.relational.EmployeeTableCreator();
tables.replaceTables(session1);
tables.replaceTables(session2);
tables.dropConstraints(session1);
tables.dropConstraints(session2);
new org.eclipse.persistence.tools.schemaframework.SchemaManager(session1).createSequences();
new org.eclipse.persistence.tools.schemaframework.SchemaManager(session2).createSequences();
new EmployeeSystem().populate(broker);
broker.logout();
}
use of org.eclipse.persistence.internal.sessions.DatabaseSessionImpl in project eclipselink by eclipse-ee4j.
the class ServerBrokerTestModel method createTables.
/**
* Create the tables on both databases.
*/
public void createTables() {
SessionBroker broker = new SessionBroker();
DatabaseSession session1 = new DatabaseSessionImpl(getLogin1());
DatabaseSession session2 = new DatabaseSessionImpl(getLogin2());
session1.addDescriptors(new EmployeeProject1());
session2.addDescriptors(new EmployeeProject2());
broker.registerSession("broker1", session1);
broker.registerSession("broker2", session2);
broker.setLog(oldSession.getLog());
broker.setLogLevel(oldSession.getLogLevel());
broker.login();
org.eclipse.persistence.testing.models.employee.relational.EmployeeTableCreator tables = new org.eclipse.persistence.testing.models.employee.relational.EmployeeTableCreator();
tables.replaceTables(session1);
tables.replaceTables(session2);
tables.dropConstraints(session1);
tables.dropConstraints(session2);
new SchemaManager(session1).createSequences();
new SchemaManager(session2).createSequences();
broker.logout();
}
use of org.eclipse.persistence.internal.sessions.DatabaseSessionImpl in project eclipselink by eclipse-ee4j.
the class BrokerTestModel method buildBroker.
/**
* Build the session broker, this assume two data-sources Broker1 and Broker2 (JConnect).
*/
public SessionBroker buildBroker() {
SessionBroker broker = new SessionBroker();
DatabaseSession session1 = new DatabaseSessionImpl(getLogin1());
DatabaseSession session2 = new DatabaseSessionImpl(getLogin2());
session1.addDescriptors(new EmployeeProject1());
session2.addDescriptors(new EmployeeProject2());
broker.registerSession("broker1", session1);
broker.registerSession("broker2", session2);
broker.setSessionLog(oldSession.getSessionLog());
broker.login();
// Set session for join table.
((ManyToManyMapping) session1.getDescriptor(Employee.class).getObjectBuilder().getMappingForAttributeName("projects")).setSessionName("broker2");
// Disable delete verify.
((OneToOneMapping) session1.getDescriptor(Employee.class).getObjectBuilder().getMappingForAttributeName("address")).setShouldVerifyDelete(false);
org.eclipse.persistence.testing.models.employee.relational.EmployeeTableCreator tables = new org.eclipse.persistence.testing.models.employee.relational.EmployeeTableCreator();
tables.replaceTables(session1);
tables.replaceTables(session2);
tables.dropConstraints(session1);
tables.dropConstraints(session2);
new SchemaManager(session1).createSequences();
new SchemaManager(session2).createSequences();
new org.eclipse.persistence.testing.models.employee.relational.EmployeeSystem().populate(broker);
return broker;
}
use of org.eclipse.persistence.internal.sessions.DatabaseSessionImpl in project eclipselink by eclipse-ee4j.
the class SQLStatement method toString.
/**
* Try to print the SQL.
*/
@Override
public String toString() {
StringWriter writer = new StringWriter();
writer.write(Helper.getShortClassName(getClass()));
writer.write("(");
try {
DatabaseCall call = buildCall(new DatabaseSessionImpl(new org.eclipse.persistence.sessions.DatabaseLogin()));
writer.write(call.getSQLString());
} catch (Exception exception) {
}
writer.write(")");
return writer.toString();
}
Aggregations