Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Compile & install cdecl on Mac OS XX (See related posts)

// description of your code here

// insert code here..


import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class Main {
public static void main(String[] a) throws Exception {
JPAUtil util = new JPAUtil();

EntityManagerFactory emf = Persistence.createEntityManagerFactory("ProfessorService");
EntityManager em = emf.createEntityManager();
ProfessorService service = new ProfessorService(em);

em.getTransaction().begin();

service.executetQuery("SELECT e.name, e.salary FROM Professor e");

util.checkData("select * from Professor");

em.getTransaction().commit();
em.close();
emf.close();
}
}


File: Address.java


import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class Address {
@Id
private int id;
private String street;
private String city;
private String state;
private String zip;

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getStreet() {
return street;
}

public void setStreet(String address) {
this.street = address;
}

public String getCity() {
return city;
}

public void setCity(String city) {
this.city = city;
}

public String getState() {
return state;
}

public void setState(String state) {
this.state = state;
}

public String getZip() {
return zip;
}

public void setZip(String zip) {
this.zip = zip;
}
public String toString() {
return "Address id: " + getId() +
", street: " + getStreet() +
", city: " + getCity() +
", state: " + getState() +
", zip: " + getZip();
}

}
Altın Fiyatları
Revizyon ile Organize Matbaacılık Brnckvvtmllttrhaberi

You need to create an account or log in to post comments to this site.


Related Posts