Apache web server for windows - Starting a Java Persistence project Listing 2.10 Mapping
Starting a Java Persistence project Listing 2.10 Mapping the Message class with annotations package hello; import javax.persistence.*; @Entity @Table(name = “MESSAGES”) public class Message { @Id @GeneratedValue @Column(name = “MESSAGE_ID”) private Long id; @Column(name = “MESSAGE_TEXT”) private String text; @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = “NEXT_MESSAGE_ID”) private Message nextMessage; private Message() {} public Message(String text) { this.text = text; } public Long getId() { return id; } private void setId(Long id) { this.id = id; } public String getText() { return text; } public void setText(String text) { this.text = text; } public Message getNextMessage() { return nextMessage; } public void setNextMessage(Message nextMessage) { this.nextMessage = nextMessage; } } The first thing you ll probably notice in this updated business class is the import of the javax.persistence interfaces. Inside this package are all the standardized JPA annotations you need to map the @Entity class to a database @Table. You put
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.