]> SALOME platform Git repositories - modules/gde.git/commitdiff
Salome HOME
Work on entities for automatic DDL generation
authorBojnourdi <kavoos.bojnourdi@edf.fr>
Thu, 27 Aug 2015 08:30:54 +0000 (10:30 +0200)
committerBojnourdi <kavoos.bojnourdi@edf.fr>
Thu, 27 Aug 2015 08:30:54 +0000 (10:30 +0200)
projects/GDE_App/GDE-ejb/src/java/com/edf/gde/entities/Chunk.java
projects/GDE_App/GDE-ejb/src/java/com/edf/gde/entities/Study.java

index d360865253458660fe22f7bedd8e05bc7afc127a..f7ebec687225f93d4f905e23585c3430cf24421d 100644 (file)
@@ -52,7 +52,7 @@ public class Chunk implements Serializable {
     @Column(name = "size")
     private long size;
     @Lob
-    @Column(name = "data")
+    @Column(name = "data",nullable = false)
     private byte[] data;
 
     public Chunk() {
index 67d633bbe41a0d39661c635a3ce697634b2bd7d7..2444a684548d2ae46317e00d66219d95c0f86e73 100644 (file)
@@ -74,8 +74,9 @@ public class Study implements Serializable {
     @OneToOne(fetch = FetchType.LAZY,optional = true)
     @JoinColumn(name = "attribute_group_id", nullable = true)
     private AttributeGroup attributeGroup;
-    @Column(name = "profile_id", nullable = true)
-    private Long profileId;
+    @OneToOne(fetch = FetchType.LAZY, optional = true)
+    @JoinColumn(name = "profile_id", nullable = true)
+    private Profile profile;
     @Column(name = "locked")
     private boolean locked;
     @Column(name = "lock_owner")
@@ -159,12 +160,12 @@ public class Study implements Serializable {
         this.attributeGroup = attributeGroup;
     }
 
-    public long getProfileId() {
-        return profileId;
+    public Profile getProfile() {
+        return profile;
     }
 
-    public void setProfileId(long profileId) {
-        this.profileId = profileId;
+    public void setProfile(Profile profile) {
+        this.profile = profile;
     }
 
     public boolean isLocked() {
@@ -201,7 +202,7 @@ public class Study implements Serializable {
         s.name = sto.getName();
         s.updateDate = sto.getUpdateDate();
         s.valid = sto.getValid();
-        s.profileId = sto.getProfileId() == 0 ? null : sto.getProfileId();
+        s.profile = sto.getProfileId() == 0 ? null : em.find(Profile.class,sto.getProfileId());
         s.locked = sto.isLocked();
         s.lockOwner = sto.getLockOwner() == 0 ? null : sto.getLockOwner();
         return s;
@@ -217,7 +218,7 @@ public class Study implements Serializable {
         sto.setName(this.name);
         sto.setUpdateDate(this.updateDate);
         sto.setValid(this.valid);
-        sto.setProfileId(this.profileId == null ? 0 : this.profileId);
+        sto.setProfileId(this.profile == null ? 0 : this.profile.getId());
         sto.setLocked(this.locked);
         sto.setLockOwner(this.lockOwner == null ? 0 : this.lockOwner);
         return sto;
@@ -238,7 +239,6 @@ public class Study implements Serializable {
         hash = 67 * hash + (this.valid ? 1 : 0);
         hash = 67 * hash + (this.deleted ? 1 : 0);
         hash = 67 * hash + Objects.hashCode(this.deletionDate);
-        hash = 67 * hash + Objects.hashCode(this.profileId);
         hash = 67 * hash + (this.locked ? 1 : 0);
         return hash;
     }