Probleme Persistance PostgreSql & Eclipse .......help SOS

controlleur Messages postés 65 Date d'inscription mercredi 27 janvier 2010 Statut Membre Dernière intervention 16 avril 2013 - 23 avril 2012 à 10:42
controlleur Messages postés 65 Date d'inscription mercredi 27 janvier 2010 Statut Membre Dernière intervention 16 avril 2013 - 23 avril 2012 à 11:19
Bonjour

j'ai créer un projet GWT (google Web toolkit) ,et j'ai créer une table avec PostgreSql : et créer un JPA java project , mais lorsque je compile j'ai erreur suivante :

Errorjavax.persistence.PersistenceException: No Persistence provider for EntityManager named MonitoringDataBase

SVP j'ai vraiment besoin d'aide, je cherche la solution depuis 4 jours ,Merci D'avance

voici le code de mon fichier XML qui bien placé dans le répertoire META-INF :



org.eclipse.persistence.jpa.PresistenceProvider


com.quali.MonitoringDataBase.shared.Ecole
com.quali.MonitoringDataBase.shared.Personne















et mon code :


public class JpaUtil {

private static final EntityManagerFactory emf;
static
{
try{
emf =Persistence.createEntityManagerFactory("ConnexionDB");
}catch (Throwable e){

System.out.println("Error"+e);
e.printStackTrace();
throw new ExceptionInInitializerError(e);
}
}
public static EntityManagerFactory getEntityManagerFactory()
{

return emf;
}

}


public class ServiceDBBImpl extends RemoteServiceServlet implements ServiceDBB {
public ArrayList getLista()
{
EntityManager em = JpaUtil.getEntityManagerFactory().createEntityManager();
String consulta = "SELECT id FROM entreprise id";
Query q=em.createQuery(consulta);
ArrayList Lista = new ArrayList(q.getResultList());
return Lista;
}
public static void main(String args[])
{
ServiceDBBImpl servicebddImpl= new ServiceDBBImpl();
for(Entreprise entreprise: servicebddImpl.getLista())
{
System.out.println("ID :"+entreprise.getId());
}
}



2 réponses

controlleur Messages postés 65 Date d'inscription mercredi 27 janvier 2010 Statut Membre Dernière intervention 16 avril 2013
23 avril 2012 à 10:44
correction j'ai posté le mauvais code pour la classe JavaUtil

public class JpaUtil {

private static final EntityManagerFactory emf;
static 
{	
try{
 emf =Persistence.createEntityManagerFactory("MonitoringDataBase");
   }catch (Throwable e){
   
   System.out.println("Error"+e);
   e.printStackTrace();
   throw new ExceptionInInitializerError(e);
   }
}
public static EntityManagerFactory getEntityManagerFactory()
{

return emf;
}

} 
0
controlleur Messages postés 65 Date d'inscription mercredi 27 janvier 2010 Statut Membre Dernière intervention 16 avril 2013
23 avril 2012 à 11:19
Helppppppppp !!!!!
0
Rejoignez-nous