Hi,
I am newbie at Hibernate. I need to insert entity Posts. But this entity has one to many with other tables. Here is described the structure of Database.
https://code.tutsplus.com/tutorials/understanding-and-working-with-data-in-wordpress--cms-20567Here is my entity
Code:
package .api.model;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
@Entity
@Table(name = "wp_posts")
@XmlRootElement
public class PlaceInsert {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID", unique = true, nullable = false)
private Long placeid;
@Basic(optional = false)
@Column(name = "post_title", unique = true, nullable = false)
private String placeTitle;
@Basic(optional = false)
@Column(name = "post_name", unique = true, nullable = false)
private String placeName;
[b]@OneToMany(fetch = FetchType.LAZY, mappedBy = "post_meta")
private String placeAddress;
private double locationX;
private double locationY;
private int city;
private String phone;
private String webUrl;
private String fbUrl;
private String googleUrl;
private String twitterUrl;[/b]
[b] private int category;
private String post_excerpt;[/b]
The parts which I selected with bold are related with one-to-many relationship from other tables. Which annotations i must use? Or I must create 3 different entities?