-->
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: net.sf.hibernate.type.LongType.set(LongType.java:
PostPosted: Thu Nov 17, 2005 2:56 am 
Newbie

Joined: Thu Nov 17, 2005 2:39 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:2.1.5

Mapping documents:

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

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Putting this post just so to save some time of others. I wasted so much time on finding out what was wrong.. Changed database types etc etc... At the end, found it was some strange problem which I possibly can attribute to Hibernate.

I used to be getting the above exception and this is how it was resolved.

By looking at the next two hbm.xml snippets, nothing seems to be wrong. But the following did not work for me.

<class name="com.xxxx" table="MUser">
<meta attribute="extends">com.xxxx.SevaBaseDO</meta>
<id column="muser_ky" name="id" type="java.lang.Long">
<generator class="identity"/>
</id>
<many-to-one name="contact" class="com.xxxxMcontact" property-ref="user" cascade="all" />

-------------------------------------------------
<class name="com.xxxxxxx.Mcontact" table="MContact">
<meta attribute="extends">com.xxxxxx.SevaBaseDO</meta>
<id column="mcontact_ky" name="id" type="java.lang.Long">
<generator class="identity"/>
</id>

<many-to-one name="user" class="com.xxxxx.Muser" column="user_ky" cascade="all"/>

To make it work:
I simply changed the many-to-one to one-to-one and it worked.
<class name="com.xxxx" table="MUser">
<meta attribute="extends">com.xxxx.SevaBaseDO</meta>
<id column="muser_ky" name="id" type="java.lang.Long">
<generator class="identity"/>
</id>
<one-to-one name="contact" class="com.xxxxMcontact" property-ref="user" cascade="all" />


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.