コード例 #1
0
  public void createTables(DatabaseSession session) {
    dropTableConstraints(session);
    new InheritanceTableCreator().replaceTables(session);

    SchemaManager schemaManager = new SchemaManager(session);
    if (session.getLogin().getPlatform().isOracle()) {
      schemaManager.replaceObject(Computer.oracleView());
      schemaManager.replaceObject(Vehicle.oracleView());
    } else if (session.getLogin().getPlatform().isSybase()) {
      schemaManager.replaceObject(Computer.sybaseView());
      schemaManager.replaceObject(Vehicle.sybaseView());
      // CREATE VIEW statement was added in MySQL 5.0.1.  Uncomment it when we support MySQL 5
      // } else if (session.getLogin().getPlatform().isMySQL()) {
      // schemaManager.replaceObject(Computer.sybaseView());
      // schemaManager.replaceObject(Vehicle.mySQLView());
    }
  }
 public void test() {
   UnitOfWork uow = getSession().acquireUnitOfWork();
   this.emp = Employee.example1();
   this.emp.asset1.asset = Vehicle.example1();
   uow.registerObject(this.emp);
   uow.commit();
   uow = getSession().acquireUnitOfWork();
   Employee empClone = (Employee) uow.registerObject(this.emp);
   Employee newClone = (Employee) empClone.clone();
   ((Vehicle) newClone.asset1.asset).make = "Beamer";
   uow.deepMergeClone(newClone);
   uow.commit();
   if (!((AbstractSession) getSession()).compareObjects(newClone, this.emp)) {
     throw new TestErrorException("Failed to merge the Variable 1 to 1 properly");
   }
 }