-->
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: Mapping Problem
PostPosted: Tue Jul 25, 2006 2:12 pm 
Newbie

Joined: Tue Jul 25, 2006 8:59 am
Posts: 18
Hibernate version:3.0

Mapping documents:Diffuseur.hbm.xml, CorrespondanceDiffuseur.hbm.xml


Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) com.plsvista.listeners.InitialHibernate
java.lang.ExceptionInInitializerError
at com.plsvista.listeners.InitialHibernate.contextInitialized(InitialHibernate.java:25)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3212)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3554)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:707)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2143)
at org.apache.catalina.startup.Catalina.start(Catalina.java:463)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:350)
at org.apache.catalina.startup.Catalina.process(Catalina.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156)
Caused by: java.lang.RuntimeException: Problème de configuration : could not instantiate id generator
at com.plsvista.hibernate.HibernateUtil2.<clinit>(HibernateUtil2.java:20)
... 17 more
Caused by: net.sf.hibernate.MappingException: could not instantiate id generator
at net.sf.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:82)
at net.sf.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:82)
at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:635)
at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:716)
at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:136)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:791)
at com.plsvista.hibernate.HibernateUtil2.<clinit>(HibernateUtil2.java:18)
... 17 more
Caused by: net.sf.hibernate.MappingException: Dialect does not support sequences
at net.sf.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:319)
at net.sf.hibernate.id.SequenceGenerator.configure(SequenceGenerator.java:62)
at net.sf.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:78)
... 24 more


Name and version of the database you are using: Oracle

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

i have a problem with a mapping :
when i start tomcat , i have this error :

net.sf.hibernate.MappingException: Dialect does not support sequences
at net.sf.hibernate.dialect.Dialect.getSequenceNextValString(Dialect.java:319)


My mapping is this <?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.2

http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->

<class
name="org.ultimania.model.Diffuseur"
table="DIFFUSEUR"
lazy="false"
dynamic-update="true"
dynamic-insert="true"
>

<id
name="idDiffuseur"
type="java.lang.Long"
column="ID_DIFFUSEUR"
>

<generator class="assigned" />
</id>

<property
name="raisonSociale"
type="java.lang.String"
column="RAISON_SOCIALE"
length="150"
/>
<property
name="idEtablissementTph"
type="java.lang.Long"
column="ID_ETABLISSEMENT_TPH"
length="22"
/>
<property
name="idEtablissementMar"
type="java.lang.Long"
column="ID_ETABLISSEMENT_MAR"
length="22"
/>
<property
name="idFournisseur"
type="java.lang.Long"
column="ID_FOURNISSEUR"
length="22"
/>
<property
name="idArm"
type="java.lang.Long"
column="ID_ARM"
length="22"
/>
<property
name="idLabo"
type="java.lang.Long"
column="ID_LABO"
length="22"
/>
<property
name="idGrossiste"
type="java.lang.Long"
column="ID_GROSSISTE"
length="22"
/>
<property
name="numeroMutation"
type="java.lang.Long"
column="NUMERO_MUTATION"
length="2"
/>
<property
name="idHoraireDiffuseur"
type="java.lang.Long"
column="ID_HORAIRE_DIFFUSEUR"
length="22"
/>
<property
name="idTypeDiffuseur"
type="java.lang.Long"
column="ID_TYPE_DIFFUSEUR"
length="22"
/>
<property
name="idTypeMagasin"
type="java.lang.Long"
column="ID_TYPE_MAGASIN"
length="22"
/>
<property
name="idCategorieTarifaire"
type="java.lang.Long"
column="ID_CATEGORIE_TARIFAIRE"
length="22"
/>
<property
name="idTypeCategoriePtv"
type="java.lang.Long"
column="ID_TYPE_CATEGORIE_PTV"
length="22"
/>
<property
name="idTypeSousCategoriePtv"
type="java.lang.Long"
column="ID_TYPE_SOUS_CATEGORIE_PTV"
length="22"
/>
<property
name="idChefRegion"
type="java.lang.Long"
column="ID_CHEF_REGION"
length="22"
/>
<property
name="idRepresentant"
type="java.lang.Long"
column="ID_REPRESENTANT"
length="22"
/>
<property
name="idLangue"
type="java.lang.Long"
column="ID_LANGUE"
length="22"
/>
<property
name="idRegion"
type="java.lang.Long"
column="ID_REGION"
length="22"
/>
<property
name="codePaysAs400"
type="java.lang.String"
column="CODE_PAYS_AS400"
length="2"
/>
<property
name="numeroRoutage"
type="java.lang.String"
column="NUMERO_ROUTAGE"
length="15"
/>
<property
name="numeroCasier"
type="java.lang.String"
column="NUMERO_CASIER"
length="15"
/>
<property
name="borneNumerique"
type="java.lang.Long"
column="BORNE_NUMERIQUE"
length="1"
/>
<property
name="idTypeStatutDiffuseur"
type="java.lang.Long"
column="ID_TYPE_STATUT_DIFFUSEUR"
length="22"
/>
<property
name="idEtatExport"
type="java.lang.Long"
column="ID_ETAT_EXPORT"
length="4"
/>
<property
name="changementDepotPrevu"
type="java.lang.Boolean"
column="CHANGEMENT_DEPOT_PREVU"
length="1"
/>
<property
name="dateCreation"
type="java.util.Date"
column="DATE_CREATION"
length="7"
/>
<property
name="dateModification"
type="java.util.Date"
column="DATE_MODIFICATION"
length="7"
/>
<property
name="dernierUtilisateur"
type="java.lang.String"
column="DERNIER_UTILISATEUR"
length="100"
/>
<property
name="etat"
type="java.lang.Boolean"
column="ETAT"
not-null="true"
length="1"
/>
<property
name="actif"
type="java.lang.String"
column="ACTIF"
length="1"
/>

<!-- Associations -->

<!-- bi-directional one-to-many association to CorrespondanceDiffuseur -->

<set
name="correspondanceDiffuseurs"
lazy="true"
inverse="true"
cascade="all"

>
<key>
<column name="ID_DIFFUSEUR" />
</key>

<one-to-many
class="org.ultimania.model.CorrespondanceDiffuseur"
/>
</set>

</class>
</hibernate-mapping>

and

?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.2

http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->

<class
name="org.ultimania.model.CorrespondanceDiffuseur"
table="CORRESPONDANCE_DIFFUSEUR"
lazy="false"
>

<id
name="idCodeDiffuseur"
type="java.lang.Long"
column="ID_CODE_DIFFUSEUR"
>

<generator class="assigned" />
</id>

<property
name="idTypeCodeDiffuseur"
type="java.lang.Long"
column="ID_TYPE_CODE_DIFFUSEUR"
length="22"
/>
<property
name="codeDiffuseur"
type="java.lang.String"
column="CODE_DIFFUSEUR"
length="30"
/>
<property
name="typeAs400"
type="java.lang.String"
column="TYPE_AS400"
length="2"
/>
<property
name="dateCreation"
type="java.util.Date"
column="DATE_CREATION"
length="7"
/>
<property
name="dateModification"
type="java.util.Date"
column="DATE_MODIFICATION"
length="7"
/>
<property
name="dernierUtilisateur"
type="java.lang.String"
column="DERNIER_UTILISATEUR"
length="30"
/>
<property
name="etat"
type="java.lang.Boolean"
column="ETAT"
length="1"
/>

<!-- Associations -->

<!-- bi-directional many-to-one association to Diffuseur -->
<many-to-one
name="diffuseur"
class="org.ultimania.model.Diffuseur"
not-null="true"
>
<column name="ID_DIFFUSEUR" />
</many-to-one>

</class>
</hibernate-mapping>


how can i debug this problem of mapping ?
i use net.sf.hibernate.dialect.Oracle9Dialect as dialect.
Thank you for your help !


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 25, 2006 3:35 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
hibernate versions 3.x package names all start with org.hibernate.xxxx not net.sf.hibernate.xxxx

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject: Do you know how i can know what mapping file generate error
PostPosted: Wed Jul 26, 2006 4:38 am 
Newbie

Joined: Tue Jul 25, 2006 8:59 am
Posts: 18
Hello,

In fact , i use Hibernate2.jar and Hibernate3.jar.
I'm not sure it's hibernate 3.0 , because i herit of this hibernate project.

Do you know how i can know what mapping file generate the error ?

Dialect does not support sequences

i don't use sequence in the mapping i added, i use assigned.


Top
 Profile  
 
 Post subject: what's bad with sequence
PostPosted: Wed Jul 26, 2006 5:59 am 
Newbie

Joined: Tue Jul 25, 2006 8:59 am
Posts: 18
i find the mapping file where there is a sequence problem :

<class name="org.ultimania.model.BonLivraison" table="BON_LIVRAISON"
lazy="true">
<id name="idBl" type="java.lang.Long" column="ID_BL">
<generator class="sequence">
<param name="sequence">SEQ_ID_BON_LIVRAISON</param>
</generator>

i use Oracle9Dialect !

The sequence exist in base.

What's the problem ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 10:12 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
that sequence mapping looks ok.

maybe you should get the dtd definitions for the same version of hibernate you use. You're using the 3.0 dtds and running hibernate 2.x

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 26, 2006 10:25 am 
Newbie

Joined: Tue Jul 25, 2006 8:59 am
Posts: 18
i try to have the dialect

i write

try {
Dialect dia= net.sf.hibernate.dialect.Dialect.getDialect();
boolean accSeq = dia.supportsSequences() ;
System.out.println("Dialect accept sequence : "+accSeq);
}
catch (HibernateException e1) {
e1.printStackTrace();
}

but it generate an exception

net.sf.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.

i have this line in hibernate.main.cfg.xml
<property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>

I have another question , what make i use Hibernate 2.x ?
if i not want to change the dtd , can i migrate to hibernate 3.x


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.