-->
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.  [ 5 posts ] 
Author Message
 Post subject: Problem mit Hibernate Mapping
PostPosted: Thu Sep 14, 2006 9:00 am 
Newbie

Joined: Thu Sep 14, 2006 8:52 am
Posts: 3
Hallo,
ich habe ein Problem bei der Abfrage eines Datensatzes aus einer MySQL Tabelle. Kann mir jemand einen Tipp geben, wo ich Informationen zu den einzelnen Dialect-Mapping Types finde (damit ich dann sehen kann, an welchem Typ das liegt)

Hibernate version:

Mapping documents:

<hibernate-mapping package="model">
<class name="Adwords" table="adwords" dynamic-update="true">

<id name="id" type="int">
<generator class="native" />
</id>

<property name="Datum" type="string"/>
<property name="Kampagne" type="string"/>
<property name="Anzeigengruppe" type="string"/>
<property name="Keyword" type="string"/>
<property name="Uebereinstimmung" type="string"/>
<property name="Status" type="string"/>
<property name="MaxCPC" type="long"/>
<property name="Url" type="string"/>
<property name="Impressionen" type="int"/>
<property name="Klicks" type="int"/>
<property name="CTR" type="float"/>
<property name="Kosten" type="long"/>
<property name="AdGroupID" type="long"/>
<property name="CriterionID" type="long"/>
<property name="Position" type="float"/>

</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
session = sessionFactory.openSession();
Query query = session.createSQLQuery("select * from adwords");
List result = query.list();
Adwords adword = (Adwords) result.get(0);
System.out.println(adword.getId());

Full stack trace of any exception that occurs:
Exception in thread "main" org.hibernate.MappingException: No Dialect mapping for JDBC type: 7
at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:192)
at org.hibernate.loader.custom.CustomLoader.getHibernateType(CustomLoader.java:161)
at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:131)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1678)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
at model.AWEDBVerbindung.getAlleAdwords(AWEDBVerbindung.java:33)
at model.RunTest.main(RunTest.java:28)


Name and version of the database you are using:
MySQL

The generated SQL (show_sql=true):
select * from adwords;

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 9:17 am 
Newbie

Joined: Thu Sep 07, 2006 11:11 am
Posts: 3
schreibe in deine hibernates.cfg.xml Datein folgendes rein.

Code:
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>


du kannst in deiner mysql-connector....jar nachschauen welche Dialecte es noch gibt!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 9:24 am 
Newbie

Joined: Thu Sep 14, 2006 8:52 am
Posts: 3
In der hibernate.cfg steht folgendes bei mir :
Code:
<property name="dialect">
         org.hibernate.dialect.MySQLDialect
      </property>


Das sollte doch richtig sein. Es muss eher an einem Type liegen, den er nicht mappen kann, Ein vorheriger Fehler war Type : 4, was "Blob" war, nachdem ich das in string umgewandelt habe, trat der Fehler nicht mehr auf.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 6:04 am 
Newbie

Joined: Fri Sep 15, 2006 5:42 am
Posts: 4
Möglicherweise wird "int" nicht richtig erkannt?
Im Manual ist nur "integer" verzeichnet.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 8:41 am 
Newbie

Joined: Thu Sep 14, 2006 8:52 am
Posts: 3
Ich habs mal umgeändert in java.lang.Integer, und habe die long Werte rausgenommen, da ich die in Dialect.java nicht gefunden habe, das Problem ist jedoch immer noch das gleiche leider.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.