import javax.persistence.Entity;
      import javax.persistence.GenerationType;
      import javax.persistence.Table;
      
      @Entity
      @Table(name = &[USER_INPUT:name], schema = &[USER_INPUT:schema)
      public class filename {
          @javax.persistence.Version
          @javax.persistence.Column(name = "version")
          int version;
      
          @javax.persistence.Id
          @javax.persistence.Column(name = "id")
          @javax.persistence.GeneratedValue(strategy = GenerationType.IDENTITY)
          private long id;
      
          public int getVersion() {
              return version;
          }
      
          public long getId() {
              return id;
          }
      
      }
      Java language logo

      Create Hibernate entity

      Create a Hibernate entity with an auto-generated id field and a version field for concurrent modifications

      Shortcut: entity

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.