Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sample/src/main/java/com/example/entity/Blog.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ public class Blog implements Serializable {
@Nonnull
@Column(name = "\"created_at\"", nullable = false)
private Timestamp createdAt;
@OneToMany(mappedBy = "blog")
private java.util.List<BlogArticle> listOfBlogArticle;
}
10 changes: 2 additions & 8 deletions sample/src/main/java/com/example/entity/BlogArticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ public class BlogArticle implements Serializable {
@GeneratedValue
@Column(name = "\"id\"", nullable = false)
private int id;
/**
* database comment for blog_id
*/
@Nullable
@Column(name = "\"blog_id\"", nullable = true)
private Integer blogId;
@Nullable
@Column(name = "\"name\"", nullable = true)
private String name;
Expand All @@ -39,9 +33,9 @@ public class BlogArticle implements Serializable {
@Nonnull
@Column(name = "\"created_at\"", nullable = false)
private Timestamp createdAt;

@lombok.Setter(lombok.AccessLevel.NONE)
@ManyToOne
@JoinColumn(name = "\"blog_id\"", referencedColumnName = "\"id\"", insertable = false, updatable = false)
private Blog blog;
@OneToMany(mappedBy = "article")
private java.util.List<BlogArticleTag> listOfBlogArticleTag;
}
18 changes: 6 additions & 12 deletions sample/src/main/java/com/example/entity/BlogArticleTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,13 @@ public class BlogArticleTag implements Serializable {
@GeneratedValue
@Column(name = "\"id\"", nullable = false)
private int id;
/**
* database comment for article_id
* The field is non-null value
*/
@Column(name = "\"article_id\"", nullable = false)
private int articleId;
/**
* database comment for blog_id
* The field is non-null value
*/
@Column(name = "\"tag_id\"", nullable = false)
private int tagId;
@Nonnull
@Column(name = "\"created_at\"", nullable = false)
private Timestamp createdAt;
@ManyToOne
@JoinColumn(name = "\"tag_id\"", referencedColumnName = "\"id\"", insertable = false, updatable = false)
private Tag tag;
@ManyToOne
@JoinColumn(name = "\"article_id\"", referencedColumnName = "\"id\"", insertable = false, updatable = false)
private BlogArticle article;
}
2 changes: 2 additions & 0 deletions sample/src/main/java/com/example/entity/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ public class Tag implements Serializable {
@Nonnull
@Column(name = "\"created_at\"", nullable = false)
private Timestamp createdAt;
@OneToMany(mappedBy = "tag")
private java.util.List<BlogArticleTag> listOfBlogArticleTag;
}
2 changes: 2 additions & 0 deletions sample/src/main/java/com/example/entity/jpa1/Blog.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ public class Blog implements Serializable {
@Nonnull
@Column(name = "`created_at`", nullable = false)
private Timestamp createdAt;
@OneToMany(mappedBy = "blog")
private java.util.List<BlogArticle> listOfBlogArticle;
}
10 changes: 2 additions & 8 deletions sample/src/main/java/com/example/entity/jpa1/BlogArticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ public class BlogArticle implements Serializable {
@GeneratedValue
@Column(name = "`id`", nullable = false)
private int id;
/**
* database comment for blog_id
*/
@Nullable
@Column(name = "`blog_id`", nullable = true)
private Integer blogId;
@Nullable
@Column(name = "`name`", nullable = true)
private String name;
Expand All @@ -39,9 +33,9 @@ public class BlogArticle implements Serializable {
@Nonnull
@Column(name = "`created_at`", nullable = false)
private Timestamp createdAt;

@lombok.Setter(lombok.AccessLevel.NONE)
@ManyToOne
@JoinColumn(name = "`blog_id`", referencedColumnName = "`id`", insertable = false, updatable = false)
private Blog blog;
@OneToMany(mappedBy = "article")
private java.util.List<BlogArticleTag> listOfBlogArticleTag;
}
18 changes: 6 additions & 12 deletions sample/src/main/java/com/example/entity/jpa1/BlogArticleTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,13 @@ public class BlogArticleTag implements Serializable {
@GeneratedValue
@Column(name = "`id`", nullable = false)
private int id;
/**
* database comment for article_id
* The field is non-null value
*/
@Column(name = "`article_id`", nullable = false)
private int articleId;
/**
* database comment for blog_id
* The field is non-null value
*/
@Column(name = "`tag_id`", nullable = false)
private int tagId;
@Nonnull
@Column(name = "`created_at`", nullable = false)
private Timestamp createdAt;
@ManyToOne
@JoinColumn(name = "`tag_id`", referencedColumnName = "`id`", insertable = false, updatable = false)
private Tag tag;
@ManyToOne
@JoinColumn(name = "`article_id`", referencedColumnName = "`id`", insertable = false, updatable = false)
private BlogArticle article;
}
2 changes: 2 additions & 0 deletions sample/src/main/java/com/example/entity/jpa1/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ public class Tag implements Serializable {
@Nonnull
@Column(name = "`created_at`", nullable = false)
private Timestamp createdAt;
@OneToMany(mappedBy = "tag")
private java.util.List<BlogArticleTag> listOfBlogArticleTag;
}
Loading