-->
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.  [ 6 posts ] 
Author Message
 Post subject: Creation de la sessionFactory dans un contener Spring
PostPosted: Sun Oct 09, 2005 11:58 am 
Newbie

Joined: Sun Oct 09, 2005 11:47 am
Posts: 9
Location: France
Bonjour

Je cherche a utiliser Hibernate et la configuration par annotations dans un contener Spring.

Mais a la creation de la sessionFactory, j'obtiens le message suivant :

Code:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/dispatcherServlet-servlet.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchFieldError: auxiliaryDatabaseObjects
java.lang.NoSuchFieldError: auxiliaryDatabaseObjects
   at org.hibernate.cfg.AnnotationConfiguration.createExtendedMappings(AnnotationConfiguration.java:126)
   at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:253)
   at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:191)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:999)



Voici mon fichier de configuration hibernate :
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
   <session-factory>
      <property name="show_sql">false</property>
      <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
      <property name="hibernate.cglib.use_reflection_optimizer">
         true
      </property>
      <!--  Mapping  -->
      <mapping class="com.mypackage.MyClass" />      
   </session-factory>
</hibernate-configuration


Et la creation de la sessionFactory dans le fichier dispatcherServlet-servlet.xml

Code:
<bean
   id="sessionFactory"
   class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
   <property name="configLocation">
      <value>/WEB-INF/hibernate.cfg.xml</value>
   </property>
   <property name="configurationClass">
      <value>org.hibernate.cfg.AnnotationConfiguration</value>
   </property>   
   <property name="dataSource">
      <ref bean="dataSource" />
   </property>
</bean>


Personne ne semble avoir eu ce type d'erreur avant moi, en tout cas google n'est pas bavard sur le sujet.

Merci d'avance.

Samuel

version: Hibernate-3.1rc et hibernate-annotations-3.1beta6


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 09, 2005 1:53 pm 
Newbie

Joined: Sun Oct 09, 2005 1:44 pm
Posts: 2
Location: Montréal
Bonjour,

je ne connais hibernate-annotations mais le mapping du fichier de config d'hibernate doit il me semble pointer vers les fichiers de mapping .hbm.xml :

Code:
<!--  Mapping  -->
<mapping class="com.mypackage.MyClass" />


devrait etre :

Code:
<!--  Mapping  -->
<mapping class="com.mypackage.MyModel.MyMappingFile1.hbm.xml" />
<mapping class="com.mypackage.MyModel.MyMappingFile2.hbm.xml" />
...



Cordialement.

Stéphane.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 09, 2005 3:05 pm 
Newbie

Joined: Sun Oct 09, 2005 11:47 am
Posts: 9
Location: France
Justement, avec les annotations les informations contenues dans les fichiers de mapping sont maintenant directement dans le code java sous forme d'annotations.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 12, 2005 3:03 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
Et est ce que ça fonctionne sans Spring ? J'ai vu ici et là qu'il y avait des incompatibilités entre certaines versions d'hibernate et certaines versions d'hibernate annotations (http://forum.hibernate.org/viewtopic.php?t=946397) tombes tu dans ce cas ?

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 12, 2005 3:11 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
Il semble y avoir des choses spéciales à faire dans Spring, tu peux plutôt poster sur leur forum pour voir ce qu'ils en disent. J'ai trouvé un thread sur le sujet mais il est assez vieux, je ne sais pas si ça à changé depuis

http://forum.springframework.org/viewto ... highlight=

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 12, 2005 11:46 am 
Newbie

Joined: Sun Oct 09, 2005 11:47 am
Posts: 9
Location: France
Le probleme semble putot vnir de la creation de la sessionFatory et non de la comptatibilité entre hibernate et hibernate annotation qui fonctionne bien sans passer par spring.
Le probleme venant justement du fait que, si je ne passe pas par spring, la sessionFactory n'est pas initialisée par spring et donc les conditions ne sont pas reunie pour provoquer le "plantage".

Quand au message sur le forum spring, je n'arrive meme pas au stade d'avoir un erreur lors de la configuration de la sessionFactory puisque celle ci n'est meme pas crée.

Merci quand meme, je continue a chercher, si d'autre personne on une idée, ils sont les bienvenues.


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

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.