-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Добавил несколько таблиц из бд в hibernate. В остальных нужно поправи…
…ть некоторые связи
- Loading branch information
Showing
20 changed files
with
356 additions
and
58 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
package entities; | ||
|
||
import javax.persistence.*; | ||
import java.sql.Timestamp; | ||
|
||
@Entity | ||
@Table(name = "posts", schema = "hotdog", catalog = "") | ||
public class PostsEntity { | ||
private int idPost; | ||
private String titel; | ||
private Timestamp createTime; | ||
private Timestamp updateTime; | ||
private String content; | ||
private int postLikeCount; | ||
private int postCommentCount; | ||
private UsersEntity usersByUsersId; | ||
|
||
@Id | ||
@Column(name = "id_post") | ||
public int getIdPost() { | ||
return idPost; | ||
} | ||
|
||
public void setIdPost(int idPost) { | ||
this.idPost = idPost; | ||
} | ||
|
||
@Basic | ||
@Column(name = "titel") | ||
public String getTitel() { | ||
return titel; | ||
} | ||
|
||
public void setTitel(String titel) { | ||
this.titel = titel; | ||
} | ||
|
||
@Basic | ||
@Column(name = "create_time") | ||
public Timestamp getCreateTime() { | ||
return createTime; | ||
} | ||
|
||
public void setCreateTime(Timestamp createTime) { | ||
this.createTime = createTime; | ||
} | ||
|
||
@Basic | ||
@Column(name = "update_time") | ||
public Timestamp getUpdateTime() { | ||
return updateTime; | ||
} | ||
|
||
public void setUpdateTime(Timestamp updateTime) { | ||
this.updateTime = updateTime; | ||
} | ||
|
||
@Basic | ||
@Column(name = "content") | ||
public String getContent() { | ||
return content; | ||
} | ||
|
||
public void setContent(String content) { | ||
this.content = content; | ||
} | ||
|
||
@Basic | ||
@Column(name = "post_like_count") | ||
public int getPostLikeCount() { | ||
return postLikeCount; | ||
} | ||
|
||
public void setPostLikeCount(int postLikeCount) { | ||
this.postLikeCount = postLikeCount; | ||
} | ||
|
||
@Basic | ||
@Column(name = "post_comment_count") | ||
public int getPostCommentCount() { | ||
return postCommentCount; | ||
} | ||
|
||
public void setPostCommentCount(int postCommentCount) { | ||
this.postCommentCount = postCommentCount; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
PostsEntity that = (PostsEntity) o; | ||
|
||
if (idPost != that.idPost) return false; | ||
if (postLikeCount != that.postLikeCount) return false; | ||
if (postCommentCount != that.postCommentCount) return false; | ||
if (titel != null ? !titel.equals(that.titel) : that.titel != null) return false; | ||
if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) return false; | ||
if (updateTime != null ? !updateTime.equals(that.updateTime) : that.updateTime != null) return false; | ||
if (content != null ? !content.equals(that.content) : that.content != null) return false; | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = idPost; | ||
result = 31 * result + (titel != null ? titel.hashCode() : 0); | ||
result = 31 * result + (createTime != null ? createTime.hashCode() : 0); | ||
result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0); | ||
result = 31 * result + (content != null ? content.hashCode() : 0); | ||
result = 31 * result + postLikeCount; | ||
result = 31 * result + postCommentCount; | ||
return result; | ||
} | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "users_id", referencedColumnName = "id", nullable = false) | ||
public UsersEntity getUsersByUsersId() { | ||
return usersByUsersId; | ||
} | ||
|
||
public void setUsersByUsersId(UsersEntity usersByUsersId) { | ||
this.usersByUsersId = usersByUsersId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package entities; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Table(name = "tags", schema = "hotdog", catalog = "") | ||
public class TagsEntity { | ||
private int idtags; | ||
private String tags; | ||
|
||
@Id | ||
@Column(name = "idtags") | ||
public int getIdtags() { | ||
return idtags; | ||
} | ||
|
||
public void setIdtags(int idtags) { | ||
this.idtags = idtags; | ||
} | ||
|
||
@Basic | ||
@Column(name = "tags") | ||
public String getTags() { | ||
return tags; | ||
} | ||
|
||
public void setTags(String tags) { | ||
this.tags = tags; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
TagsEntity that = (TagsEntity) o; | ||
|
||
if (idtags != that.idtags) return false; | ||
if (tags != null ? !tags.equals(that.tags) : that.tags != null) return false; | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = idtags; | ||
result = 31 * result + (tags != null ? tags.hashCode() : 0); | ||
return result; | ||
} | ||
} |
Oops, something went wrong.