Olá, Pessoal
Estou desenvolvendo uma implemetação utilizando JPA no netbeans 6.8 segue abaixo a listagem dos códiogs:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="myJPAExamplePU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>br.com.peres.jpa.entity.People</class>
<properties>
<property name="hibernate.connection.username" value="app"/>
<property name="hibernate.connection.driver_class" value="org.apache.derby.jdbc.ClientDriver"/>
<property name="hibernate.connection.password" value="app"/>
<property name="hibernate.connection.url" value="jdbc:derby://localhost:1527/Siscom"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
package br.com.peres.jpa.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity(name="PEOPLE")
public class People implements java.io.Serializable {
@Id
@Column(nullable=false, name="ID")
private Integer id;
@Column(nullable=false, name="NAME")
private String name;
@Column(nullable=false, name="AGE")
private Integer age;
public People() {
}
public People(Integer id) {
this.id = id;
}
public People(Integer id, String name, Integer age) {
this.id = id;
this.name = name;
this.age = age;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final People other = (People) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 41 * hash + (this.id != null ? this.id.hashCode() : 0);
return hash;
}
}
E é nessa classe que mora o problemas que não consigo resolver
package br.com.peres.jpa;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
public class TheClassApp {
EntityManagerFactory emf = new Persistence.createEntityManagerFactory("myJPAExamplePU"); // Erro aqui
}
Quando compilo aparece o sequinte erro:
init:
Deleting: C:\Users\Peres\Documents\NetBeansProjects\myJPAExample\build\built-jar.properties
deps-jar:
Updating property file: C:\Users\Peres\Documents\NetBeansProjects\myJPAExample\build\built-jar.properties
Compiling 1 source file to C:\Users\Peres\Documents\NetBeansProjects\myJPAExample\build\classes
C:\Users\Peres\Documents\NetBeansProjects\myJPAExample\src\br\com\peres\jpa\TheClassApp.java:17: cannot find symbol
symbol : class createEntityManagerFactory
location: class javax.persistence.Persistence
EntityManagerFactory emf = new Persistence.createEntityManagerFactory("myJPAExamplePU");
1 error
C:\Users\Peres\Documents\NetBeansProjects\myJPAExample\nbproject\build-impl.xml:430: The following error occurred while executing this line:
C:\Users\Peres\Documents\NetBeansProjects\myJPAExample\nbproject\build-impl.xml:199: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)
Já tentei de tudo será que alguém pode me dar uma luz, desde já agradeço
Abraços e boa pácoa