예제 #1
0
 public TableDesc getTableDesc(EntityMeta entityMeta, PropertyMeta propertyMeta) {
   GenerationType generationType = propertyMeta.getGenerationType();
   if (generationType == GenerationType.AUTO) {
     generationType = dialect.getDefaultGenerationType();
   }
   if (generationType == GenerationType.TABLE) {
     TableGenerator generator = getTableGenerator(entityMeta, propertyMeta);
     TableDesc tableDesc = new TableDesc();
     doName(entityMeta, tableDesc, generator);
     doPrimaryKeyColumn(entityMeta, tableDesc, generator);
     doValueColumn(entityMeta, tableDesc, generator);
     doUniqueConstraints(entityMeta, tableDesc, generator);
     return tableDesc;
   }
   return null;
 }
예제 #2
0
 public SequenceDesc getSequenceDesc(EntityMeta entityMeta, PropertyMeta propertyMeta) {
   GenerationType generationType = propertyMeta.getGenerationType();
   if (generationType == GenerationType.AUTO) {
     generationType = dialect.getDefaultGenerationType();
   }
   if (generationType == GenerationType.SEQUENCE) {
     if (!dialect.supportsSequence()) {
       throw new UnsupportedGenerationTypeRuntimeException(
           GenerationType.SEQUENCE, entityMeta.getName(), propertyMeta.getName());
     }
     SequenceGenerator generator = getSequenceGenerator(entityMeta, propertyMeta);
     SequenceDesc sequenceDesc = new SequenceDesc();
     String sequenceName = getSequenceName(entityMeta, propertyMeta, generator);
     sequenceDesc.setSequenceName(sequenceName);
     sequenceDesc.setInitialValue(generator.initialValue());
     sequenceDesc.setAllocationSize(generator.allocationSize());
     sequenceDesc.setDataType(getDataType(propertyMeta));
     return sequenceDesc;
   }
   return null;
 }