Flux rss
Collection CommentCaMarche.net
Rechercher : dans
Par : Pertinence Date Nom d'utilisateur
Statut : Non résolu

Hibernate2, eclipse europa et oracle 10g

lucky82, le samedi 10 mai 2008 à 21:00:08
Bonjour a tous,

je travaille sous eclipse europa et hibernate 3 et oracle 10g, j'ai essayé de suivre les etapes du tutoriel (insertion dans une table) suivant: http://defaut.developpez.com/tutoriel/java/eclipse/hibernate­/fichiers/hibernate.pdf

mais lors de l'execution du projet, je recois ceci comme erreur:


log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment).

log4j:WARN Please initialize the log4j system properly.

Exception in thread "main" java.lang.ExceptionInInitializerError

at Test.main(Test.java:8)

Caused by: java.lang.RuntimeException: Problème de configuration : Error reading resource: Compte.hbm

at com.minosis.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:14)

... 1 more

Caused by: net.sf.hibernate.MappingException: Error reading resource: Compte.hbm

at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:340)

at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1027)

at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:983)

at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:911)

at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)

at com.minosis.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:11)

... 1 more

Caused by: net.sf.hibernate.MappingException: invalid mapping

at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:288)

at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:337)

... 6 more

Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,(cache|jcs-cache)?,(id|composite-id),discriminator?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|any|map|set|list|bag|idbag|array|primitive-array)*,(subclass*|joined-subclass*))".

at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)

at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)

at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)

at org.dom4j.io.SAXReader.read(SAXReader.java:465)

at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:287)

... 7 more

Veuillez m'aidez svp
Configuration: Windows XP
Internet Explorer 7.0
Répondre à lucky82  Signaler ce message aux modérateurs Aller au dernier message

1


  • Ce message vous semble utile, votez !
  • Signaler ce message aux modérateurs
espaceinfo, le samedi 10 mai 2008 à 21:11:37
bonjour, assure toi que tu as JDK et JRE
Répondre à espaceinfo

2


  • Ce message vous semble utile, votez !
  • Signaler ce message aux modérateurs
lucky82, le samedi 10 mai 2008 à 21:16:20
oui, oui, j'en suis sur, j'avais meme essayé un helloWorld avec jsf!
Répondre à lucky82

3


  • Ce message vous semble utile, votez !
  • Signaler ce message aux modérateurs
espaceinfo, le samedi 10 mai 2008 à 21:21:04
j'essaye de chercher.. parceque ces messages j'ai jamais rencontré!
Répondre à espaceinfo

4


  • Ce message vous semble utile, votez !
  • Signaler ce message aux modérateurs
lucky82, le samedi 10 mai 2008 à 21:26:45
ok, dsl pour dérangement
Répondre à lucky82

5


  • Ce message vous semble utile, votez !
  • Signaler ce message aux modérateurs
lucky82, le dimanche 11 mai 2008 à 11:45:27
bjr encore une fois,
boon, j'avais un Compte.hbm du genre:



<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC

"-//Hibernate/Hibernate Mapping DTD//EN"

"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >


<hibernate-mapping package="com.minosis.hibernate">

<class name="Compte" table="COMPTE">

<property

column="LOGIN_COMPTE"

length="20"

name="LoginCompte"

not-null="false"

type="string"

/>

<property

column="ID_COMPTE"

length="6"

name="IdCompte"

not-null="false"

type="integer"

/>

<property

column="PROFIL_COMPTE"

length="20"

name="ProfilCompte"

not-null="false"

type="string"

/>

<property

column="PASSWORD_COMPTE"

length="10"

name="PasswordCompte"

not-null="false"

type="string"

/>

</class>

</hibernate-mapping>


je l'ai corrigé de cette facon:




<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC

"-//Hibernate/Hibernate Mapping DTD//EN"

"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >


<hibernate-mapping>

<class name="com.houda.Compte" table="COMPTE">


<id name="IdCompte" type="integer">

<column name="ID_COMPTE" length="6"/>

<generator class="increment"/>

</id>



<property name="LoginCompte" type="string">

<column name="LOGIN_COMPTE" length="20" not-null="false"/>

</property>


<property name="ProfilCompte" type="string">

<column name="PROFIL_COMPTE" length="20" not-null="false"/>

</property>


<property name="PasswordCompte" type="string">

<column name="PASSWORD_COMPTE" length="10" not-null="false"/>

</property>


</class>

</hibernate-mapping>

mé j'ai encore des erreurs:



0 [main] INFO net.sf.hibernate.cfg.Environment - Hibernate 2.1.8

0 [main] INFO net.sf.hibernate.cfg.Environment - hibernate.properties not found

0 [main] INFO net.sf.hibernate.cfg.Environment - using CGLIB reflection optimizer

0 [main] INFO net.sf.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling

0 [main] INFO net.sf.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml

0 [main] INFO net.sf.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml

78 [main] DEBUG net.sf.hibernate.util.DTDEntityResolver - trying to locate http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd in classpath under net/sf/hibernate/

78 [main] DEBUG net.sf.hibernate.util.DTDEntityResolver - found http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd in classpath

110 [main] DEBUG net.sf.hibernate.cfg.Configuration - hibernate.connection.url=jdbc:oracle:thin:@localhost:1521:safaqat

110 [main] DEBUG net.sf.hibernate.cfg.Configuration - hibernate.connection.driver_class=oracle.jdbc.OracleDriver

110 [main] DEBUG net.sf.hibernate.cfg.Configuration - hibernate.connection.username=scott

110 [main] DEBUG net.sf.hibernate.cfg.Configuration - hibernate.connection.password=tiger

110 [main] DEBUG net.sf.hibernate.cfg.Configuration - dialect=net.sf.hibernate.dialect.OracleDialect

110 [main] DEBUG net.sf.hibernate.cfg.Configuration - hibernate.show_sql=false

110 [main] DEBUG net.sf.hibernate.cfg.Configuration - hibernate.use_outer_join=true

110 [main] DEBUG net.sf.hibernate.cfg.Configuration - hibernate.transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory

110 [main] DEBUG net.sf.hibernate.cfg.Configuration - null<-org.dom4j.tree.DefaultAttribute@89cf1e [Attribute: name resource value "Compte.hbm"]

110 [main] INFO net.sf.hibernate.cfg.Configuration - Mapping resource: Compte.hbm

110 [main] DEBUG net.sf.hibernate.util.DTDEntityResolver - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath under net/sf/hibernate/

110 [main] DEBUG net.sf.hibernate.util.DTDEntityResolver - found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in classpath

172 [main] INFO net.sf.hibernate.cfg.Binder - Mapping class: com.houda.Compte -> COMPTE

219 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: IdCompte -> ID_COMPTE, type: integer

219 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: LoginCompte -> LOGIN_COMPTE, type: string

219 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: ProfilCompte -> PROFIL_COMPTE, type: string

219 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: PasswordCompte -> PASSWORD_COMPTE, type: string

219 [main] INFO net.sf.hibernate.cfg.Configuration - Configured SessionFactory: null

.......
...

219 [main] INFO net.sf.hibernate.cfg.Configuration - processing one-to-many association mappings

219 [main] INFO net.sf.hibernate.cfg.Configuration - processing one-to-one association property references

219 [main] INFO net.sf.hibernate.cfg.Configuration - processing foreign key constraints

235 [main] INFO net.sf.hibernate.dialect.Dialect - Using dialect: net.sf.hibernate.dialect.OracleDialect

250 [main] DEBUG net.sf.hibernate.exception.SQLExceptionConverterFactory - Using dialect defined converter

250 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Use outer join fetching: true

250 [main] INFO net.sf.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)

250 [main] INFO net.sf.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20

266 [main] INFO net.sf.hibernate.connection.DriverManagerConnectionProvider - using driver: oracle.jdbc.OracleDriver at URL: jdbc:oracle:thin:@localhost:1521:safaqat

266 [main] INFO net.sf.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=scott, password=tiger}

266 [main] INFO net.sf.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory

266 [main] INFO net.sf.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)

266 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - total checked-out connections: 0

266 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - opening new JDBC connection

750 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - created connection to: jdbc:oracle:thin:@localhost:1521:safaqat, Isolation Level: 2

766 [main] DEBUG net.sf.hibernate.connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1

766 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Use scrollable result sets: true

766 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Use JDBC3 getGeneratedKeys(): false

766 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: false

766 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Query language substitutions: {}

766 [main] INFO net.sf.hibernate.cfg.SettingsFactory - cache provider: net.sf.hibernate.cache.EhCacheProvider

766 [main] DEBUG net.sf.hibernate.cfg.SettingsFactory - Wrap result sets enabled? : false

766 [main] INFO net.sf.hibernate.cfg.Configuration - instantiating and configuring caches

766 [main] DEBUG net.sf.ehcache.CacheManager - Creating new CacheManager with default config

766 [main] DEBUG net.sf.ehcache.CacheManager - Configuring ehcache from classpath.

781 [main] WARN net.sf.ehcache.config.ConfigurationFactory - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/F:/Modules%20etudies/Master%20QL/2eme%20annee/S4%20---stage/SIS/Developpement/Eclipse%20Workspace/hib/WebContent/WEB-INF/lib/ehcache-1.2.3.jar!/ehcache-failsafe.xml

781 [main] DEBUG net.sf.ehcache.config.ConfigurationFactory - Configuring ehcache from URL: jar:file:/F:/Modules%20etudies/Master%20QL/2eme%20annee/S4%20---stage/SIS/Developpement/Eclipse%20Workspace/hib/WebContent/WEB-INF/lib/ehcache-1.2.3.jar!/ehcache-failsafe.xml

781 [main] DEBUG net.sf.ehcache.config.ConfigurationFactory - Configuring ehcache from InputStream

781 [main] DEBUG net.sf.ehcache.config.DiskStoreConfiguration - Disk Store Path: C:\DOCUME~1\dell\LOCALS~1\Temp\

797 [main] DEBUG net.sf.ehcache.config.ConfigurationHelper - No CacheManagerEventListenerFactory class specified. Skipping...

797 [main] DEBUG net.sf.ehcache.config.ConfigurationHelper - No CachePeerListenerFactoryConfiguration specified. Not configuring a CacheManagerPeerListener.

797 [main] DEBUG net.sf.ehcache.config.ConfigurationHelper - No CachePeerProviderFactoryConfiguration specified. Not configuring a CacheManagerPeerProvider.

844 [main] DEBUG net.sf.ehcache.config.ConfigurationHelper - No BootstrapCacheLoaderFactory class specified. Skipping...

Exception in thread "main" java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V

at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:47)

at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)

at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)

at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:215)

at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)

at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)

at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)

at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)

at net.sf.hibernate.impl.SessionFactoryImpl.<clinit>(SessionFactoryImpl.java:237)

at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:805)

at com.houda.HibernateUtil.<clinit>(HibernateUtil.java:12)

at Test.main(Test.java:11)
Répondre à lucky82

6


  • Ce message vous semble utile, votez !
  • Signaler ce message aux modérateurs
lucky82, le dimanche 11 mai 2008 à 14:00:29
l'insertion et l'update marchent tres bien, par contre la lecture non:




import java.util.*;

import net.sf.hibernate.*;

import com.minosis.hibernate.*;


public class Test {
public static void main(String[] args) throws HibernateException {
org.apache.log4j.BasicConfigurator.configure();



//insertion dans la table COMPTE
/*Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
Compte compte = new Compte();
compte.setIdCompte(new Integer(44));
compte.setLoginCompte("Dupont");
compte.setPasswordCompte("Jean");
session.save(compte);
tx.commit();
HibernateUtil.closeSession();*/

//update du profil du compte num 3
/*Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
Compte compte =(Compte) session.load(Compte.class, new Integer(3));
compte.setProfilCompte("Jacques");
session.save(compte);
tx.commit();
HibernateUtil.closeSession();
*/


//lecture a partir de la table compte
try {
Session session = HibernateUtil.currentSession();

List list = session.find("from COMPTE ");
Iterator it = list.iterator();

while(it.hasNext())
{
Compte compte = (Compte)it.next();
System.out.println(compte.getLoginCompte());
}

HibernateUtil.closeSession();
} catch (HibernateException e) {
e.printStackTrace();
}
}
}
Répondre à lucky82

7


  • Ce message vous semble utile, votez !
  • Signaler ce message aux modérateurs
 lucky82, le dimanche 11 mai 2008 à 14:32:10
En fait:

il fallait mettre


List list = session.find("from Compte ");
au lieu de
List list = session.find("from COMPTE");

Merci pour vous tous
Répondre à lucky82
Oracle 10g (Résolu) bonjour svp aidez moi !! je prépare mon projet de fin d'etude ,et je doit créer une base de donnée sous oracle ,j'ai instaler oracle 10g express edition mais quand j'ecris la commande sous sqlplus :"create database nom de la base;"une... www.commentcamarche.net/forum/affich-2913794-oracle-10g
Oracle 10g (Résolu) Bonjour a vous !! voila j'ai développé une application avec oracle 10g ( c une application client/serveur et marche dans environnement web !) la question est : comment faire marcher l'application mais sans installer oracle sur la machine... www.commentcamarche.net/forum/affich-8085724-oracle-10g
JBoss 5.0.0 et eclipse europa (Résolu) encore moi :D com.genuitec.eclipse.core_1.0.0 et com.genuitec.eclipse.easie.jboss_1.2.0 ce sont bien les plugins qu'il faut utiliser pour JBoss 5.0.0 et eclipse europa ?!!!! si oui pourquoi quand j'essai de lancer JBoss depui eclipse... www.commentcamarche.net/forum/affich-9881055-jboss-5-0-0-et-eclipse-europa
Configuration préventive minimale conseilléeConfiguration conseillée : Cette config n’est pas une panacée mais se veut en tout cas une bonne prévention pour la sécurité de votre PC. Anti-virus : http://www.commentcamarche.net/telecharger/telecharger 151 avast N’oublier pas de vous inscrire en... www.commentcamarche.net/faq/sujet-7753-configuration-pr-ventive-minimale-conseill-e
Connexion à une base Oracle en php1. Périmètre Cet article est un exemple de connexion à une base Oracle par le biais d'un script php. Cet article ne traite pas la configuration de votre serveur Oracle, et de votre client Oracle. Nous partons du principe que vous pouvez accéder à... www.commentcamarche.net/faq/sujet-123-connexion-a-une-base-oracle-en-php
Desinstallation Oracle 10g sous vista (Résolu)Bonjours j'ai instalé Oracle 10g sur mon pc (DELL inspiron 1525, je veut le desnstaller , j'ai trouver un article http://fadace.developpez.com/oracle/desinstall/ , j'ai commencé a desistallé, apres quand j'ai commencé a avec... www.commentcamarche.net/forum/affich-9209077-desinstallation-oracle-10g-sous-vista
Démarrage automatique d'oracle (Résolu)Bonjour, j'ai installé oracle 10g sur une dbian4 j'ai fait le script /etc/init.d/oracle pour démarrer et arrêter automatiquement oracle comme un service. voici le contenu du script #!/bin/sh # description: Script de demarrage d'oracle... www.commentcamarche.net/forum/affich-4611602-demarrage-automatique-d-oracle
Installation 1oracle 10g (Résolu)Bonjour, J'ai installé oracle 10g sous windows vista. Mais quand je lance une exécution d'un module Forms l'écran se fige sur la 1ére fénetre d'oracle et puis internet explorer aprés plusieurs minutes s'arrête. Y-a t'il... www.commentcamarche.net/forum/affich-4264223-installation-1oracle-10g
Europa Universalis III Collector's EditionGenre:Straégie, Développeur:Paradox Interactive, Description:The third in the strategy series, Europa Universalis III explores the areas of exploration, trade, warfare and diplomacy, and invites players to take change the course history and the world... www.commentcamarche.net/guide-achat/europa-universalis-iii-collector-s-edition-753407-fiche-technique
L'éclipse de soleil visible également sur Internet(Paris - Relax news) - La prochaine éclipse de soleil, qui se produira vendredi 1er août, sera partielle pour une grande partie de la planète, dont la France métropolitaine, où le degré d'obscuration ne dépassera pas 10%. En revanche, elle sera totale... www.commentcamarche.net/actualites/l-eclipse-de-soleil-visible-egalement-sur-internet-5847121-actualite.php3
Oracle - Introduction au SGBD OracleIntroduction au SGBD Oracle Oracle est un SGBD (système de gestion de bases de données) édité par la société du même nom (Oracle Corporation - http://www.oracle.com), leader mondial des bases de données. La société Oracle Corporation a été créée en... www.commentcamarche.net/contents/oracle/oracintro.php3
Oracle - Les séquencesCet article s'appuie sur la version 8.1.6 d'Oracle. Une séquence est un objet de base de données Oracle, au même titre qu'une table, une vue, etc... Autrement dit, il appartient à un utilisateur, on peut le manipuler, le modifier, à condition... www.commentcamarche.net/contents/oracle/oracseq.php3
Oracle - Les fichiers d'une base OracleLes fichiers physiques d'une base Oracle Les fichiers physiques d'une base Oracle permettent de stocker de manière persistante les données manipulées par Oracle, tandis que la mémoire sert à optimiser la vitesse de fonctionnement de la base de... www.commentcamarche.net/contents/oracle/oracfich.php3