I am using netbeans 6.9.1, Glassfish 3.1. I am trying to write some values to the MYSQL table.
this works and the records gets saved to the table with no problem. But everytime when i restart glassfish or build the project all the saved data from the MySQL tables gets erased. How do i avoid this.
I have used Entity beans and Persistence to create table (auto generate tables)
@Entity
public class HotelVacancy implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToOne (cascade=CascadeType.ALL)
private Hotel hotId;
private int noVancies;
public Long getId() {
return id;
}
...
How do i solve this
When you have follow (or similar) row in your
persistence.xml:<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>delete it.