Some more Info:
Thats the Worker.java class:
package de.mash.project.server;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Persistence;
import javax.persistence.Table;
import javax.persistence.Transient;
@Entity
@Table(name = "Worker")
public class Worker {
public static Worker findWorker(Long id) {
// if (id == 0) {
return null;
// }
// EntityManager em = entityManager();
// try {
// Worker worker = em.find(Worker.class, id);
// return worker;
// } finally {
// em.close();
// }
}
@Transient
protected Object[] jdoDetachedState;
// @Id
// @GeneratedValue(generator = "auto_increment")
// @GenericGenerator(name = "auto_increment", strategy = "increment")
// @Column(name = "id")
// private int id;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "first_name")
private String firstName;
@Column(name = "last_name")
private String lastName;
@Column(name = "salary")
private int salary;
public Worker() {
}
public Worker(String fname, String lname, int salary) {
this.firstName = fname;
this.lastName = lname;
this.salary = salary;
}
public Long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String first_name) {
this.firstName = first_name;
}
public String getLastName() {
return lastName;
}
public void setLastName(String last_name) {
this.lastName = last_name;
}
public int getSalary() {
return salary;
}
public void setSalary(int salary) {
this.salary = salary;
}
public static Long countWorkers() {
return 2l;
}
public Integer getVersion() {
return 1;
}
public void persist() {
// EntityManager em = entityManager();
EntityManagerFactory emf = Persistence.createEntityManagerFactory("transactions-optional");
EntityManager em = emf.createEntityManager();
try {
em.persist(this);
} catch (Exception e) {
int i = 1;
} finally {
em.close();
}
}
public static final EntityManager entityManager() {
return EMF.get().createEntityManager();
}
} --
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/8u2bMxOgz3QJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment