Editor

009 Entity Design

how to use the entity design and view of ApiHug Api design Copilot.

Go through the entity design and view panel of ApiHug Api design Copilot

  1. Entity design panel
  2. Source code route
ApiHug Entity Manager

Proto Sample

Please refer: apihug-full-demo account.proto

Protobuf
message AccountEntity {
  string name = 1 [(hope.persistence.column) = {
    name: "NAME",
    description: "name of the account",
    nullable: false,
    updatable: false,
    length: {
      value: 32
    },
    type: VARCHAR
  }];

  string email = 2 [(hope.persistence.column) = {
    name: "EMAIL",
    description: "email of the account",
    updatable: false,
    unique: TRUE,
    length: {
      value: 64
    },
    type: VARCHAR
  }];
}

Java Sample

Please refer: apihug-full-demo AccountEntity.java

Java
@Table(
        name = "DEMO_USER_ACCOUNT",
        indexes = {
                @Index(name = "IDX_DEMO_USER_ACCOUNT_NAME", columnList = "NAME"),
                @Index(name = "IDX_DEMO_USER_ACCOUNT_EMAIL", columnList = "EMAIL")
        }
)
@org.springframework.data.relational.core.mapping.Table("DEMO_USER_ACCOUNT")
@Generated("H.O.P.E. Infra Team")
public final class AccountEntity extends Domain<AccountEntity, Long, Long> {
    @Column("NAME")
    @Description("name of the account")
    @jakarta.persistence.Column(
            name = "NAME",
            insertable = true,
            length = 32
    )
    protected String name;
}

Repository: apihug-full-demo AccountEntityRepository.java

Java
@Repository
public interface AccountEntityRepository extends HopeJdbc<AccountEntity>, UserJdbcSupport, AccountEntityDSL, ListCrudRepository<AccountEntity, Long> {
    default void _save(AccountEntity entity) {
        //...
    }
}

Reference

  1. ApiHug101-Bilibili
  2. ApiHug101-Youtube
Copyright © 2026 ApiHug·AI-native Enterprise Architecture Factory