@Column(name = "deletion_date")
@Temporal(TemporalType.TIMESTAMP)
private Date deletionDate;
- @Column(name = "attribute_group_id")
- private long attributeGroupId;
- @Column(name = "profile_id")
- private long profileId;
+ @Column(name = "attribute_group_id", nullable = true)
+ private Long attributeGroupId;
+ @Column(name = "profile_id", nullable = true)
+ private Long profileId;
@Column(name ="locked")
private boolean locked;
public Study() {
s.creationDate = sto.getCreationDate();
s.deleted = sto.getDeleted();
s.deletionDate = sto.getDeletionDate();
- s.attributeGroupId = sto.getAttributeGroupId();
+ s.attributeGroupId = sto.getAttributeGroupId()==0?null:sto.getAttributeGroupId();
s.id = sto.getId();
s.name = sto.getName();
s.updateDate = sto.getUpdateDate();
s.valid = sto.getValid();
- s.profileId = sto.getProfileId();
+ s.profileId = sto.getProfileId()==0?null:sto.getProfileId();
s.locked = sto.isLocked();
return s;
}
sto.setCreationDate(this.creationDate);
sto.setDeleted(this.deleted);
sto.setDeletionDate(this.deletionDate);
- sto.setAttributeGroupId(this.attributeGroupId);
+ sto.setAttributeGroupId(this.attributeGroupId==null?0:this.attributeGroupId);
sto.setId(this.id);
sto.setName(this.name);
sto.setUpdateDate(this.updateDate);
sto.setValid(this.valid);
- sto.setProfileId(this.profileId);
+ sto.setProfileId(this.profileId==null?0:this.profileId);
sto.setLocked(this.locked);
return sto;
}
@Override
public int hashCode() {
- int hash = 7;
- hash = 11 * hash + (int) (this.id ^ (this.id >>> 32));
- hash = 11 * hash + Objects.hashCode(this.name);
- hash = 11 * hash + Objects.hashCode(this.creationDate);
- hash = 11 * hash + Objects.hashCode(this.updateDate);
- hash = 11 * hash + Objects.hashCode(this.valid);
- hash = 11 * hash + Objects.hashCode(this.deleted);
- hash = 11 * hash + Objects.hashCode(this.deletionDate);
- hash = 11 * hash + (int) (this.attributeGroupId ^ (this.attributeGroupId >>> 32));
- hash = 11 * hash + (int) (this.profileId ^ (this.profileId >>> 32));
+ int hash = 5;
+ hash = 67 * hash + (int) (this.id ^ (this.id >>> 32));
+ hash = 67 * hash + Objects.hashCode(this.name);
+ hash = 67 * hash + Objects.hashCode(this.creationDate);
+ hash = 67 * hash + Objects.hashCode(this.updateDate);
+ 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.attributeGroupId);
+ hash = 67 * hash + Objects.hashCode(this.profileId);
+ hash = 67 * hash + (this.locked ? 1 : 0);
return hash;
}
return true;
}
+
}
*/
package com.edf.gde.test.dao;
+import com.edf.gde.dao.StudyDaoClient;
+import com.edf.gde.transferables.StudyTO;
+import java.util.Date;
import org.junit.After;
import org.junit.AfterClass;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Test;
/**
*
public void tearDown() {
}
+ @Test
public void testCreateStudy() throws Exception {
-
+ System.out.println("createStudy");
+ StudyDaoClient daoClient = new StudyDaoClient();
+ StudyTO studyTO = new StudyTO();
+ studyTO.setName("My study");
+ studyTO.setCreationDate(new Date(System.currentTimeMillis()));
+ studyTO.setValid(true);
+ StudyTO newStudyTO = daoClient.createStudy(studyTO);
+ assertNotNull(newStudyTO);
+ assertEquals(studyTO.getName(), newStudyTO.getName());
}
}