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: Decimals cause mapping exception
PostPosted: Sat Jun 28, 2008 12:09 pm 
Newbie

Joined: Thu Jun 26, 2008 2:20 pm
Posts: 1
Hibernate version:1.2

Mapping documents:
Code:
<class name="KFZ" table="kfz" discriminator-value="K">
   
    <id name="zulassung" type="String" length="20">
      <generator class="increment"/>
    </id>
    <discriminator column="fahrzeugKlasse" type="Char"/>

    <property name="preis" type="Decimal" length="2" />
   

    <subclass name="PKW" discriminator-value="P">
      <property name="anzahlTueren" type="Int32"/>
      <!--many-to-one  name="zulassung"  class="KFZ" /-->
     
    </subclass>
   
    <subclass name="LKW" discriminator-value="L">
      <property name="zuladung" type="Int32"/>
      <!--many-to-one  name="zulassung"  class="KFZ" /-->
    </subclass>

  </class>


Full stack trace of any exception that occurs:

Code:
"   bei NHibernate.Persister.Entity.AbstractEntityPersister.SetPropertyValues(Object obj, Object[] values)\r\n   bei NHibernate.Impl.SessionImpl.InitializeEntity(Object obj)\r\n   bei NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session)\r\n   bei NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)\r\n   bei NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)\r\n   bei NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)\r\n   bei NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)\r\n   bei NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes)\r\n   bei NHibernate.Hql.Classic.QueryTranslator.List(ISessionImplementor session, QueryParameters queryParameters)\r\n   bei NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters, IList results)\r\n   bei NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters)\r\n   bei NHibernate.Impl.QueryImpl.List()\r\n   bei KFZVerleih.KFZVerwaltung.loadData() in C:\\Studium\\Datenbank\\Labor 6\\KFZVerleih\\KFZVerwaltung.cs:Zeile 73.\r\n   bei KFZVerleih.KFZVerwaltung..ctor(KFZVerleih gui) in C:\\Studium\\Datenbank\\Labor 6\\KFZVerleih\\KFZVerwaltung.cs:Zeile 57.\r\n   bei KFZVerleih.KFZVerleih..ctor() in C:\\Studium\\Datenbank\\Labor 6\\KFZVerleih\\KFZ_Verleih.cs:Zeile 31.\r\n   bei KFZVerleih.Program.Main() in C:\\Studium\\Datenbank\\Labor 6\\KFZVerleih\\Program.cs:Zeile 17.\r\n   bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n   bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n   bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n   bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n   bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   bei System.Threading.ThreadHelper.ThreadStart()"



Name and version of the database you are using: mysql 5


I have the following problem, i create these KFZ classes , actually PKW or LKW, since KFZ is abstract, and nh write them correctly (checked in database directly)
But the next time i want to read the saved objects with
Code:
kfzs = new List<KFZ>();
            q = session.CreateQuery("FROM KFZ");
            list = q.List();

I get the
Code:
MappingException
Invalid mapping information specified for type KFZVerleih.PKW, check your mapping file for property type mismatches


It causes errors only with decimal, no problems loading stuff without it.
Searching for that problem ended in not very helpful posts.

Actually setting the length allows me to controll the precision, but is there way to controll the scale too? type="Decimal(precision,scale)" did not work, also length="precision,scale" didnt :/


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.