IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JPA Java Discussion :

[jpa] [hiBERNATE] deployment application


Sujet :

JPA Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre très actif
    Inscrit en
    Novembre 2004
    Messages
    234
    Détails du profil
    Informations forums :
    Inscription : Novembre 2004
    Messages : 234
    Par défaut [jpa] [hiBERNATE] deployment application
    Bonjour
    Comme je n'ai pas eu de réponse pour les criteriaBuilder en jpa,je me retourne vers la solution JPA/hibernate.mais manque de chance j'ai encore des problèmes
    j'ai reconfiguré mon ancienne application pour faire fonctionner Hibernate c'est a dire effacer toutes les librairies en ajoutant les librairies de HIbernate(j'ai pris la lib du tuto JPA de Tahe . ca ne fonctionne pas.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    '2.0' of attribute 'version' of element 'entity-mappings' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.
    	com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    	com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
    	com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
    	com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
    	com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:417)
    	com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3182)
    	com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processOneAttribute(XMLSchemaValidator.java:2802)
    	com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2714)
    	com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2066)
    	com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)
    	com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
    	com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
    	com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3103)
    	com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)
    	com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    	com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    	com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    	com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    	com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    	com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    	com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    	com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    	org.dom4j.io.SAXReader.read(SAXReader.java:465)
    	org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:668)
    	org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:920)
    	org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:750)
    	org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:178)
    	org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:235)
    	org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
    	javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
    	javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
    	Login.execute(Login.java:23)
    	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	java.lang.reflect.Method.invoke(Method.java:597)
    	com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
    	com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
    	com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
    	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
    	org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
    	com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
    	com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    	org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
    	org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    	org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    ma librairie

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    /examplestrust170711/WebContent/WEB-INF/lib/antlr-2.7.6.jar
    /examplestrust170711/WebContent/WEB-INF/lib/asm.jar
    /examplestrust170711/WebContent/WEB-INF/lib/asm-attrs.jar
    /examplestrust170711/WebContent/WEB-INF/lib/c3p0-0.9.0.jar
    /examplestrust170711/WebContent/WEB-INF/lib/cglib-2.1.3.jar
    /examplestrust170711/WebContent/WEB-INF/lib/commons-beanutils-1.8.0.jar
    /examplestrust170711/WebContent/WEB-INF/lib/commons-collections-3.2.1.jar
    /examplestrust170711/WebContent/WEB-INF/lib/commons-digester-1.8.jar
    /examplestrust170711/WebContent/WEB-INF/lib/commons-fileupload-1.2.1.jar
    /examplestrust170711/WebContent/WEB-INF/lib/commons-io-1.3.2.jar
    /examplestrust170711/WebContent/WEB-INF/lib/commons-lang-2.6.jar
    /examplestrust170711/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar
    /examplestrust170711/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar
    /examplestrust170711/WebContent/WEB-INF/lib/commons-validator-1.3.1.jar
    /examplestrust170711/WebContent/WEB-INF/lib/dom4j-1.6.1.jar
    /examplestrust170711/WebContent/WEB-INF/lib/ejb3-persistence.jar
    /examplestrust170711/WebContent/WEB-INF/lib/freemarker-2.3.16.jar
    /examplestrust170711/WebContent/WEB-INF/lib/hibernate3.jar
    /examplestrust170711/WebContent/WEB-INF/lib/hibernate-annotations.jar
    /examplestrust170711/WebContent/WEB-INF/lib/hibernate-entitymanager.jar
    /examplestrust170711/WebContent/WEB-INF/lib/hibernate-tools.jar
    /examplestrust170711/WebContent/WEB-INF/lib/javassist.jar
    /examplestrust170711/WebContent/WEB-INF/lib/javassist-3.7.ga.jar
    /examplestrust170711/WebContent/WEB-INF/lib/jboss-archive-browsing.jar
    /examplestrust170711/WebContent/WEB-INF/lib/jta.jar
    /examplestrust170711/WebContent/WEB-INF/lib/ognl-3.0.jar
    /examplestrust170711/WebContent/WEB-INF/lib/sitemesh-3.0-alpha-2.jar
    /examplestrust170711/WebContent/WEB-INF/lib/struts2-convention-plugin-2.2.1.1.jar
    /examplestrust170711/WebContent/WEB-INF/lib/struts2-core-2.2.1.1.jar
    /examplestrust170711/WebContent/WEB-INF/lib/struts2-dojo-plugin-2.1.8.1.jar
    /examplestrust170711/WebContent/WEB-INF/lib/struts2-jquery-chart-plugin-3.0.2.jar
    /examplestrust170711/WebContent/WEB-INF/lib/struts2-jquery-grid-plugin-3.0.2.jar
    /examplestrust170711/WebContent/WEB-INF/lib/struts2-jquery-plugin-3.0.2.jar
    /examplestrust170711/WebContent/WEB-INF/lib/struts2-jquery-richtext-plugin-3.0.2.jar
    /examplestrust170711/WebContent/WEB-INF/lib/struts2-jquery-tree-plugin-3.0.2.jar
    /examplestrust170711/WebContent/WEB-INF/lib/struts2-json-plugin-2.2.1.1.jar
    /examplestrust170711/WebContent/WEB-INF/lib/struts-menu-2.4.3 .jar
    /examplestrust170711/WebContent/WEB-INF/lib/velocity-1.5.jar
    /examplestrust170711/WebContent/WEB-INF/lib/velocity-dep-1.4.jar
    /examplestrust170711/WebContent/WEB-INF/lib/velocity-tools-1.3.jar
    /examplestrust170711/WebContent/WEB-INF/lib/velocity-tools-view-1.0.jar
    /examplestrust170711/WebContent/WEB-INF/lib/xalan-2.7.0.jar
    /examplestrust170711/WebContent/WEB-INF/lib/xercesImpl-2.6.2.jar
    /examplestrust170711/WebContent/WEB-INF/lib/xml-apis-1.0.b2.jar
    /examplestrust170711/WebContent/WEB-INF/lib/xmlParserAPIs-2.6.2.jar
    /examplestrust170711/WebContent/WEB-INF/lib/xom-1.1.jar
    /examplestrust170711/WebContent/WEB-INF/lib/xwork-core-2.2.1.1.jar
    mon fichier de persistence.xml
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="2.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_2_0.xsd">
    	<persistence-unit name="jpapersonne" transaction-type="RESOURCE_LOCAL" >
     
    		<provider>org.hibernate.ejb.HibernatePersistence</provider>
    		<class>jpa.Animaux</class>
    		<class>jpa.Personne</class>
    		<properties>
     
     
    			 <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
            <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/adresse"/>
            <property name="hibernate.connection.username" value="root"/>
            <property name="javax.persistence.jdbc.password" value=""/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
    		</properties>
    	</persistence-unit>
    </persistence>
    a oui mon code pour pour m'identifier:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    private EntityManagerFactory emf;
    	 private EntityManager em;
    	 private String PERSISTENCE_UNIT_NAME = "jpapersonne";
    	 public String execute() {
     
    		 emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
    	     em = emf.createEntityManager();
    	     System.out.println(Password);
     
    	 Query query=em.createQuery("SELECT p FROM Personne p where p.nom_personne Like :nom5 AND p.password like:nom6");
    	 	query.setParameter("nom5",username);
    	 	query.setParameter("nom6",Password);

  2. #2
    Membre émérite

    Profil pro
    Technicien
    Inscrit en
    Février 2009
    Messages
    335
    Détails du profil
    Informations personnelles :
    Âge : 47
    Localisation : France

    Informations professionnelles :
    Activité : Technicien

    Informations forums :
    Inscription : Février 2009
    Messages : 335
    Par défaut
    Bonjour,

    Est-ce qu'il ne manque pas la version hibernate-jpa-2.0-api-1.0.0.Final.jar dans tes librairies ?

    Cf. les liens suivants :
    http://docs.jboss.org/hibernate/enti...iguration.html
    http://forum.springsource.org/showth...s-not-validate

    Et le message trouvé dans la stacktrace :
    org.xml.sax.SAXParseException: cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'entity-mappings' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.
    Benoit

  3. #3
    Membre très actif
    Inscrit en
    Novembre 2004
    Messages
    234
    Détails du profil
    Informations forums :
    Inscription : Novembre 2004
    Messages : 234
    Par défaut
    effectivement cest cela il faut taper config jpahibernate sur google et on va sur la hibernate ou il donne les lib necessaires.
    Merci

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Application java Struts2, JPA, Hibernate
    Par mdh12 dans le forum Débuter avec Java
    Réponses: 5
    Dernier message: 26/07/2010, 07h33
  2. jpa hibernate eclipse 3.2.2
    Par lamnaourS dans le forum JPA
    Réponses: 5
    Dernier message: 15/07/2009, 17h07
  3. [JPA / Hibernate] Cascade qui ne cascade pas !
    Par dazz_x dans le forum Persistance des données
    Réponses: 1
    Dernier message: 11/09/2007, 13h35
  4. JPA / Hibernate.
    Par Ho(c)ine. dans le forum Persistance des données
    Réponses: 2
    Dernier message: 23/08/2007, 15h39

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo