-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: ERREUR Not binding factory to JNDI, no JNDI name configured
PostPosted: Mon Feb 21, 2011 6:04 pm 
Newbie

Joined: Mon Feb 21, 2011 5:43 pm
Posts: 1
Bonsoir Tous,
voila ma business class
package com.hibernate.base;

public class Departement {
private int iddep;
private String nom;
public int getIddepartemnt() {
return iddep;
}
public Departement(int iddepartemnt, String nom) {
super();
this.iddep = iddepartemnt;
this.nom = nom;
}

public Departement() {
super();
// TODO Auto-generated constructor stub
}

public void setIddepartemnt(int iddepartemnt) {
this.iddep = iddepartemnt;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}

}
mon fichier hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">azerty</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/dbtraining</property>
<property name="hibernate.connection.username">root</property>


<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping class="com.hibernate.base.Departement" package="com.hibernate.base"/>
</session-factory>
</hibernate-configuration>

le fichier mapping departement.hbm.cfg
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">azerty</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/dbtraining</property>
<property name="hibernate.connection.username">root</property>


<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping class="com.hibernate.base.Departement" package="com.hibernate.base"/>
</session-factory>
</hibernate-configuration>



le fichier main ; Run.java
package com.main;
import com.hibernate.base.*;
import com.hibernate.base.dao.*;
import java.util.*;



import org.hibernate.*;
//import org.hibernate.util.*;
import org.hibernate.cfg.Configuration;
import org.hibernate.classic.Session ;
public class Run {

/**
* @param args
*/
public static void main(String[] args) {

Session session = null;

try{


SessionFactory sessionFactory = new

Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();



System.out.println("Inserting Record");
Departement dept = new Departement();
dept.setIddepartemnt(989);
dept.setNom("logistique");

session.save(dept);
System.out.println("Done");
}catch(Exception e){
System.out.println(e.getMessage());
}finally{

session.flush();
session.close();

}
}
}

après l'exécution je reçois

208 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
220 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.6.1.Final
222 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
227 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
231 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
317 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml
317 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml
389 [main] WARN org.hibernate.util.DTDEntityResolver - recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
423 [main] INFO org.hibernate.cfg.Configuration - Mapping package com.hibernate.base
473 [main] WARN org.hibernate.cfg.AnnotationBinder - Package not found or wo package-info.java: com.hibernate.base
473 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
488 [main] INFO org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring
494 [main] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
500 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
500 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
500 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
508 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/dbtraining
509 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=root, password=****}
798 [main] INFO org.hibernate.cfg.SettingsFactory - Database ->
name : MySQL
version : 5.1.45-community
major : 5
minor : 1
798 [main] INFO org.hibernate.cfg.SettingsFactory - Driver ->
name : MySQL-AB JDBC Driver
version : mysql-connector-java-5.0.8 ( Revision: ${svn.Revision} )
major : 5
minor : 0
826 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQLDialect
840 [main] INFO org.hibernate.engine.jdbc.JdbcSupportLoader - Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
841 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
843 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
843 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
843 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
844 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
844 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
844 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
844 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
844 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
845 [main] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2
845 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
845 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
845 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
845 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
845 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
847 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
847 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
847 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
847 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
848 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
848 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
849 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
849 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
854 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
854 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
854 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
854 [main] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
854 [main] INFO org.hibernate.cfg.SettingsFactory - Check Nullability in Core (should be disabled when Bean Validation is on): enabled
883 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
892 [main] INFO org.hibernate.type.BasicTypeRegistry - Type registration [wrapper_characters_clob] overrides previous : org.hibernate.type.CharacterArrayClobType@12a3793
892 [main] INFO org.hibernate.type.BasicTypeRegistry - Type registration [materialized_blob] overrides previous : org.hibernate.type.MaterializedBlobType@a6d51e
892 [main] INFO org.hibernate.type.BasicTypeRegistry - Type registration [wrapper_materialized_blob] overrides previous : org.hibernate.type.WrappedMaterializedBlobType@f1bb78
892 [main] INFO org.hibernate.type.BasicTypeRegistry - Type registration [blob] overrides previous : org.hibernate.type.BlobType@4b035d
892 [main] INFO org.hibernate.type.BasicTypeRegistry - Type registration [java.sql.Blob] overrides previous : org.hibernate.type.BlobType@4b035d
892 [main] INFO org.hibernate.type.BasicTypeRegistry - Type registration [clob] overrides previous : org.hibernate.type.ClobType@ca0115
892 [main] INFO org.hibernate.type.BasicTypeRegistry - Type registration [java.sql.Clob] overrides previous : org.hibernate.type.ClobType@ca0115
892 [main] INFO org.hibernate.type.BasicTypeRegistry - Type registration [materialized_clob] overrides previous : org.hibernate.type.MaterializedClobType@d1fa5
892 [main] INFO org.hibernate.type.BasicTypeRegistry - Type registration [characters_clob] overrides previous : org.hibernate.type.PrimitiveCharacterArrayClobType@198a455
939 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
Inserting Record
Unknown entity: com.hibernate.base.Departement



aprés l'actualisation de la table je ne vois la nouvelle insertion
merci de votre aide


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.