Commit a68834f5 by Yiming Liu

Add Mapping Entity

parent 06e51680
...@@ -3,7 +3,10 @@ package com.ctrip.apollo.biz.entity; ...@@ -3,7 +3,10 @@ package com.ctrip.apollo.biz.entity;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import org.hibernate.annotations.SQLDelete;
@Entity @Entity
@SQLDelete(sql = "Update App set isDeleted = 1 where id = ?")
public class App extends BaseEntity { public class App extends BaseEntity {
@Column(nullable = false) @Column(nullable = false)
......
...@@ -6,11 +6,9 @@ import javax.persistence.Column; ...@@ -6,11 +6,9 @@ import javax.persistence.Column;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where; import org.hibernate.annotations.Where;
@Where(clause = "isDeleted = 0") @Where(clause = "isDeleted = 0")
@SQLDelete(sql = "Update Cluster set isDeleted = 1 where id = ?")
public abstract class BaseEntity { public abstract class BaseEntity {
@Id @Id
......
...@@ -3,10 +3,13 @@ package com.ctrip.apollo.biz.entity; ...@@ -3,10 +3,13 @@ package com.ctrip.apollo.biz.entity;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import org.hibernate.annotations.SQLDelete;
/** /**
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
*/ */
@Entity @Entity
@SQLDelete(sql = "Update Cluster set isDeleted = 1 where id = ?")
public class Cluster extends BaseEntity { public class Cluster extends BaseEntity {
@Column(nullable = false) @Column(nullable = false)
......
...@@ -3,7 +3,10 @@ package com.ctrip.apollo.biz.entity; ...@@ -3,7 +3,10 @@ package com.ctrip.apollo.biz.entity;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import org.hibernate.annotations.SQLDelete;
@Entity @Entity
@SQLDelete(sql = "Update Group set isDeleted = 1 where id = ?")
public class Group extends BaseEntity { public class Group extends BaseEntity {
@Column(nullable = false) @Column(nullable = false)
......
...@@ -3,8 +3,11 @@ package com.ctrip.apollo.biz.entity; ...@@ -3,8 +3,11 @@ package com.ctrip.apollo.biz.entity;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import org.hibernate.annotations.SQLDelete;
@Entity @Entity
public class Item extends BaseEntity { @SQLDelete(sql = "Update Item set isDeleted = 1 where id = ?")
public class Item extends BaseEntity {
@Column(nullable = false) @Column(nullable = false)
private long groupId; private long groupId;
......
package com.ctrip.apollo.biz.entity;
import javax.persistence.Entity;
import org.hibernate.annotations.SQLDelete;
@Entity
@SQLDelete(sql = "Update Mapping set isDeleted = 1 where id = ?")
public class Mapping extends BaseEntity {
private long versionId;
private long releaseId;
public long getReleaseId() {
return releaseId;
}
public long getVersionId() {
return versionId;
}
public void setReleaseId(long releaseId) {
this.releaseId = releaseId;
}
public void setVersionId(long versionId) {
this.versionId = versionId;
}
}
...@@ -3,7 +3,10 @@ package com.ctrip.apollo.biz.entity; ...@@ -3,7 +3,10 @@ package com.ctrip.apollo.biz.entity;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import org.hibernate.annotations.SQLDelete;
@Entity @Entity
@SQLDelete(sql = "Update Namespace set isDeleted = 1 where id = ?")
public class Namespace extends BaseEntity{ public class Namespace extends BaseEntity{
@Column(nullable = false) @Column(nullable = false)
......
...@@ -7,10 +7,13 @@ import javax.persistence.Entity; ...@@ -7,10 +7,13 @@ import javax.persistence.Entity;
import javax.persistence.Lob; import javax.persistence.Lob;
import javax.persistence.ManyToMany; import javax.persistence.ManyToMany;
import org.hibernate.annotations.SQLDelete;
/** /**
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
*/ */
@Entity @Entity
@SQLDelete(sql = "Update Release set isDeleted = 1 where id = ?")
public class Release extends BaseEntity{ public class Release extends BaseEntity{
@Column(nullable = false) @Column(nullable = false)
......
...@@ -6,10 +6,13 @@ import javax.persistence.Column; ...@@ -6,10 +6,13 @@ import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.ManyToMany; import javax.persistence.ManyToMany;
import org.hibernate.annotations.SQLDelete;
/** /**
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
*/ */
@Entity @Entity
@SQLDelete(sql = "Update Version set isDeleted = 1 where id = ?")
public class Version extends BaseEntity { public class Version extends BaseEntity {
@Column(nullable = false) @Column(nullable = false)
...@@ -20,7 +23,7 @@ public class Version extends BaseEntity { ...@@ -20,7 +23,7 @@ public class Version extends BaseEntity {
// parent version could be null // parent version could be null
@Column @Column
private Long parentVersion; private Long parentVersionId;
@ManyToMany @ManyToMany
private List<Release> releases; private List<Release> releases;
...@@ -33,8 +36,8 @@ public class Version extends BaseEntity { ...@@ -33,8 +36,8 @@ public class Version extends BaseEntity {
return name; return name;
} }
public Long getParentVersion() { public Long getParentVersionId() {
return parentVersion; return parentVersionId;
} }
public List<Release> getReleases() { public List<Release> getReleases() {
...@@ -50,8 +53,8 @@ public class Version extends BaseEntity { ...@@ -50,8 +53,8 @@ public class Version extends BaseEntity {
this.name = name; this.name = name;
} }
public void setParentVersion(Long parentVersion) { public void setParentVersionId(Long parentVersionId) {
this.parentVersion = parentVersion; this.parentVersionId = parentVersionId;
} }
public void setReleases(List<Release> releases) { public void setReleases(List<Release> releases) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment