Create Hibernate entity



    Leoni Lubbinge

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

    Shortcut: entity

    import javax.persistence.Entity;
    import javax.persistence.GenerationType;
    import javax.persistence.Table;
    @Table(name = &[USER_INPUT], schema = &[USER_INPUT)
    public class filename {
        @javax.persistence.Column(name = "version")
        int version;
        @javax.persistence.Column(name = "id")
        @javax.persistence.GeneratedValue(strategy = GenerationType.IDENTITY)
        private long id;
        public int getVersion() {
            return version;
        public long getId() {
            return id;
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.