package com.validation.manager.core.db;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Javier A. Ortiz Bultron <javier.ortiz.78@gmail.com>
 */
@Embeddable
public class AttachmentPK implements Serializable {

    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private int id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "attachment_type_id")
    private int attachmentTypeId;

    public AttachmentPK() {
    }

    public AttachmentPK(int id, int attachmentTypeId) {
        this.id = id;
        this.attachmentTypeId = attachmentTypeId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getAttachmentTypeId() {
        return attachmentTypeId;
    }

    public void setAttachmentTypeId(int attachmentTypeId) {
        this.attachmentTypeId = attachmentTypeId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) id;
        hash += (int) attachmentTypeId;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AttachmentPK)) {
            return false;
        }
        AttachmentPK other = (AttachmentPK) object;
        if (this.id != other.id) {
            return false;
        }
        return this.attachmentTypeId == other.attachmentTypeId;
    }

    @Override
    public String toString() {
        return "com.validation.manager.core.db.AttachmentPK[ id=" + id
                + ", attachmentTypeId=" + attachmentTypeId + " ]";
    }
}

@@ -167,24 +167,150 @@
 mbeddable;%0D%0A
+import javax.persistence.GeneratedValue;%0D%0Aimport javax.persistence.GenerationType;%0D%0Aimport javax.persistence.TableGenerator;%0D%0A
 import javax
@@ -557,24 +557,379 @@
 me = %22id%22)%0D%0A
+    @GeneratedValue(strategy = GenerationType.TABLE,%0D%0A            generator = %22Attachment_IDGEN%22)%0D%0A    @TableGenerator(name = %22Attachment_IDGEN%22, table = %22vm_id%22,%0D%0A            pkColumnName = %22table_name%22,%0D%0A            valueColumnName = %22last_id%22,%0D%0A            pkColumnValue = %22attachment%22,%0D%0A            initialValue = 1,%0D%0A            allocationSize = 1)%0D%0A
     private 

Add id generator.