Esempio n. 1
0
  private AbstractPersistentBeanDescriptor createOperateAuditInfoDescriptor(
      PersistentBeanDescriptorContext context) {
    EmbeddablePersistentBeanDescriptor descriptor = new EmbeddablePersistentBeanDescriptor();
    descriptor.setBeanClass(OperateAuditInfo.class);

    List<IPropertyDescriptor> properties = new ArrayList<IPropertyDescriptor>();
    {
      PersistentBeanPropertyDescriptor property = new PersistentBeanPropertyDescriptor();
      property.setName("createUserId");
      PrimitivePersistentColumn column = new PrimitivePersistentColumn();
      column.setName("CREATE_USER_ID");
      column.setType(PrimitiveColumnType.LONG);
      property.setPersistentColumn(column);
      properties.add(property);
    }

    {
      PersistentBeanPropertyDescriptor property = new PersistentBeanPropertyDescriptor();
      property.setName("createTime");
      PrimitivePersistentColumn column = new PrimitivePersistentColumn();
      column.setName("CREATE_TIME");
      column.setType(PrimitiveColumnType.TIMESTAMP);
      property.setPersistentColumn(column);
      properties.add(property);
    }

    descriptor.setProperties(properties);
    context.register(descriptor);
    return descriptor;
  }
Esempio n. 2
0
  private AbstractPersistentBeanDescriptor createPersonDescriptor(
      PersistentBeanDescriptorContext context) {
    StandalonePersistentBeanDescriptor descriptor = new StandalonePersistentBeanDescriptor();
    descriptor.setBeanClass(Person.class);
    descriptor.setTableName("T_PERSON");

    List<IPropertyDescriptor> properties = new ArrayList<IPropertyDescriptor>();
    {
      PersistentBeanPropertyDescriptor property = new PersistentBeanPropertyDescriptor();
      property.setName("id");
      PrimitivePersistentColumn column = new PrimitivePersistentColumn();
      column.setName("PERSON_ID");
      column.setType(PrimitiveColumnType.LONG);
      column.setPrimaryKey(true);
      HiloKey key = new HiloKey();
      column.setPrimaryKeyGenerator(key);
      property.setPersistentColumn(column);
      properties.add(property);
    }

    {
      PersistentBeanPropertyDescriptor property = new PersistentBeanPropertyDescriptor();
      property.setName("name");
      PrimitivePersistentColumn column = new PrimitivePersistentColumn();
      column.setName("PERSON_NAME");
      column.setType(PrimitiveColumnType.STRING);
      property.setPersistentColumn(column);
      properties.add(property);
    }

    {
      PersistentBeanPropertyDescriptor property = new PersistentBeanPropertyDescriptor();
      property.setName("operateAuditInfo");
      EmbeddedPersistentColumn column = new EmbeddedPersistentColumn();
      column.setEmbeddedBeanClass(OperateAuditInfo.class);
      column.addOverriddenColumnName("createUserId", "CREATE_USER_ID");
      column.addOverriddenColumnName("createTime", "CREATE_TIME");
      column.setPropertyDescriptor(property);
      property.setPersistentColumn(column);
      properties.add(property);
    }

    descriptor.setProperties(properties);
    context.register(descriptor);
    return descriptor;
  }