package com.dteknoloji.domain;

import java.io.Serializable;
import javax.persistence.*;
import org.springframework.hateoas.ResourceSupport;

@Entity
@Table(name = "beacons")
public class Beacon extends ResourceSupport implements Serializable {

    @Id
    @Column(name = "beacon_id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long beaconId;

    @Column(name = "uuid", nullable = false)
    private String uuid;

    @Column(name = "major", nullable = false)
    private String major;

    @Column(name = "minor", nullable = false)
    private String minor;

//    @JsonIgnore
//    @Column(name = "GROUP_ID", nullable = true)
//    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
//    @JoinColumn(name = "GROUP_ID", nullable = true)
//    private Long groupId;

    @Column(name = "description", nullable = true)
    private String description;


    public Long getBeaconId() {
        return beaconId;
    }

    public void setBeaconId(Long beaconId) {
        this.beaconId = beaconId;
    }

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public String getMinor() {
        return minor;
    }

    public void setMinor(String minor) {
        this.minor = minor;
    }

//    public Long getGroupId() {
//        return groupId;
//    }
//
//    public void setGroupId(Long groupId) {
//        this.groupId = groupId;
//    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}

@@ -82,16 +82,58 @@
 ence.*;%0A
+import javax.validation.constraints.Size;%0A
 import o
@@ -438,32 +438,62 @@
 llable = false)%0A
+    @Size(min = 36, max = 36)%0A
     private Stri
@@ -540,32 +540,60 @@
 llable = false)%0A
+    @Size(min = 4, max = 4)%0A
     private Stri
@@ -645,24 +645,52 @@
 le = false)%0A
+    @Size(min = 4, max = 4)%0A
     private 
@@ -708,93 +708,57 @@
 r;%0A%0A
-//
     @
-JsonIgnore%0A//    @Column(name = %22GROUP_ID%22, nullable = true)%0A//    @ManyToOne(
+ManyToOne(targetEntity = BeaconGroup.class, 
 fetc
@@ -802,20 +802,35 @@
 Type.ALL
+, optional = true
 )%0A
-//
     @Joi
@@ -849,38 +849,61 @@
  = %22
-GROUP_ID%22, nullable = true)%0A//
+group_id%22, referencedColumnName = %22beacon_group_id%22)%0A
     
@@ -972,24 +972,54 @@
 ble = true)%0A
+    @Size(min = 0, max = 200)%0A
     private 
@@ -1039,17 +1039,16 @@
 ption;%0A%0A
-%0A
     publ
@@ -1591,18 +1591,16 @@
 %0A    %7D%0A%0A
-//
     publ
@@ -1618,26 +1618,24 @@
 GroupId() %7B%0A
-//
         retu
@@ -1650,21 +1650,15 @@
 Id;%0A
-//
     %7D%0A
-//%0A//
+%0A
     
@@ -1696,18 +1696,16 @@
 upId) %7B%0A
-//
         
@@ -1732,10 +1732,8 @@
 Id;%0A
-//
     

Add size constraints to beacon attributes