-->
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: nHibernate and MySQL 5.0
PostPosted: Tue May 22, 2007 8:39 am 
Newbie

Joined: Tue May 22, 2007 8:21 am
Posts: 1
Hello,

I encounter a problem with nHibernate 1.2 et MySQL 5.0. This problem didn't occurs with MYSQL 4.1.

Actually, the problem occurs at the tables creation, when the table are created, there is no default value. So when I create an object of the base class, everythings from other class are set to null and I receive the exception :

"The field "TripPathID" has no default value."


Here is part of the mapping file :

Code:
<?xml version="1.0" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">
   <class name="DOL.GS.GenericItem, GameServer" table="`item`">
      <id name="ItemID" column="`ItemID`" unsaved-value="0">
         <generator class="native" />
      </id>
      <discriminator column="GenericItemType"/>
      
      <property name="Name" type="String(255)" not-null="true" column="`Name`"/>
      <property name="Level" type="Byte" not-null="true" column="`Level`"/>
      <property name="Weight" type="Int32" not-null="true" column="`Weight`"/>
      <property name="Value" type="Int64" not-null="true" column="`Value`"/>
      <property name="Realm" not-null="true" column="`Realm`"/>
      <property name="Model" type="Int32" not-null="true" column="`Model`"/>
      <property name="IsSaleable" type="YesNo" not-null="true" column="`IsSaleable`"/>
      <property name="IsTradable" type="YesNo" not-null="true" column="`IsTradable`"/>
      <property name="IsDropable" type="YesNo" not-null="true" column="`IsDropable`"/>
      <property name="QuestName" type="String(255)" not-null="true" column="`QuestName`"/>
      <property name="CrafterName" type="String(255)" not-null="true" column="`CrafterName`"/>
      <property name="SlotPosition" type="Int32" not-null="true" column="`SlotPosition`"/>
      
      <many-to-one name="Owner" class="DOL.GS.GamePlayer, GameServer" not-null="true" column="`Owner`"/>
      
      <subclass name="DOL.GS.TravelTicket, GameServer">
         <property name="TripPathID" type="Int32" not-null="true" column="`TripPathID`" />
      </subclass>
      <subclass name="DOL.GS.CraftingTool, GameServer">
         <property name="Type" not-null="true" column="`Type`" />
      </subclass>
      <subclass name="DOL.GS.RespecStone, GameServer">
         <property name="RespecType" not-null="true" column="`RespecType`" />
      </subclass>
....


in the nHibernate configuration file I changed the dialect to use MySQL5.Dialect, but this as no effect.

If someone has some advice, or solution, thanks you.


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.