Пример #1
0
 protected Entity map(String tableName, String primaryKeyName, String sequenceName) {
   PersisterFactory.getPersister().registerEntity(this, tableName);
   PersisterFactory.getPersister()
       .registerPrimaryKey(this, primaryKey, primaryKeyName, sequenceName);
   PersisterFactory.getPersister().registerTimestamp(this, timeStamp, TIMESTAMP_NAME);
   return this;
 }
Пример #2
0
  public <T extends Entity> Reference<T> referenceProperty(
      T referredEntity, String name, String mapping, String indexName, boolean required) {
    Reference<T> property =
        new Reference<T>(this.getId() + "." + name, referredEntity, this, required);
    property.setLocalizationKey(this.getId() + "." + name);
    properties.add(property);
    if (indexName == null) {
      PersisterFactory.getPersister().registerReference(this, property, mapping, referredEntity);
    } else {
      PersisterFactory.getPersister()
          .registerReference(this, property, mapping, referredEntity, indexName);
    }

    return property;
  }
Пример #3
0
 public BinaryProperty binaryProperty(String name) {
   BinaryProperty property = new BinaryProperty(this.getId() + "." + name, this);
   property.setLocalizationKey(this.getId() + "." + name);
   properties.add(property);
   PersisterFactory.getPersister().registerProperty(this, property, name);
   return property;
 }
Пример #4
0
 public <T extends Entity> Collection<T> reverseCollectionProperty(
     String name, T referredEntity, Reference<? extends Entity> referringColumn) {
   Collection<T> property = new Collection<T>(this.getId() + "." + name, referredEntity, this);
   property.setLocalizationKey(this.getId() + "." + name);
   properties.add(property);
   PersisterFactory.getPersister().registerReverseCollection(property, referringColumn);
   return property;
 }
Пример #5
0
  public <T extends Entity> Collection<T> collectionProperty(
      T referredEntity, String name, String mapping, String indexName) {
    Collection<T> property = new Collection<T>(this.getId() + "." + name, referredEntity, this);
    property.setLocalizationKey(this.getId() + "." + name);
    properties.add(property);

    PersisterFactory.getPersister()
        .registerReference(referredEntity, property, mapping, this, indexName);

    return property;
  }
Пример #6
0
  protected Entity(String name, String tableName, String primaryKeyName, String sequenceName) {
    super(name);
    setLocalizationKey(name);

    Property<Integer> pk =
        new Property<Integer>(
            this.getId() + "." + "PRIMARY_KEY", Integer.class, 0, true, this, false, null);
    primaryKey = pk;
    primaryKey.setLocalizationKey("ID");

    Property<Date> ts =
        new Property<Date>(
            this.getId() + "." + TIMESTAMP_NAME, Date.class, 0, false, this, false, null);
    timeStamp = ts;
    timeStamp.setLocalizationKey("timeStamp");

    PersisterFactory.getPersister().registerEntity(this, tableName);
    PersisterFactory.getPersister()
        .registerPrimaryKey(this, primaryKey, primaryKeyName, sequenceName);
    PersisterFactory.getPersister().registerTimestamp(this, timeStamp, TIMESTAMP_NAME);
  }
Пример #7
0
 private <X extends Serializable> Property<X> addProperty(
     String name,
     Class<X> type,
     double size,
     boolean required,
     boolean virtual,
     String formatPattern) {
   Property<X> property =
       new Property<X>(
           this.getId() + "." + name, type, size, required, this, virtual, formatPattern);
   property.setLocalizationKey(this.getId() + "." + name);
   properties.add(property);
   if (!virtual) {
     PersisterFactory.getPersister().registerProperty(this, property, name);
   }
   return property;
 }
Пример #8
0
 public View inheritanceView(View masterView, Property<String> discriminator, Enum<?> value) {
   View view = new SubView(masterView, discriminator, value);
   PersisterFactory.getPersister().addInheritanceIndex(this, discriminator);
   return view;
 }
Пример #9
0
 public void addIndex(String name, boolean unique, Property<?>... properties) {
   PersisterFactory.getPersister().registerIndex(this, name, unique, properties);
 }