prima implementazione di persistence usando eclipselink e database integrato in glassfish.
This commit is contained in:
41
test3_persistence/test_class.java
Normal file
41
test3_persistence/test_class.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package test3_persistence;
|
||||
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.NamedQuery;
|
||||
|
||||
@Entity
|
||||
@NamedQuery(name = "findxg", query = "SELECT b FROM test_class b WHERE b.title ='xg'")
|
||||
public class test_class {
|
||||
|
||||
@Id @GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@PostConstruct
|
||||
public void ps (){
|
||||
title = "xg";
|
||||
}
|
||||
|
||||
private String title;
|
||||
|
||||
private Double price;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public Double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Double price) {
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user