-->
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.  [ 2 posts ] 
Author Message
 Post subject: Session.save() problem
PostPosted: Wed Sep 15, 2010 2:59 pm 
Newbie

Joined: Tue Sep 14, 2010 8:45 pm
Posts: 2
Guys, I am running out of ideas here. Somehow when I invoke the following snippet:

// retrieval of 'user' and 'media' obj from DB
UserMedia userMedia = new UserMedia();
userMedia.setUser(user);
userMedia.setMedia(media);
session.save(userMedia);

This code is giving me the exception
Quote:
Caused by: java.sql.BatchUpdateException: Field 'UUID' doesn't have a default value


It would be nice if someone took a glance at my HBMs as I am completelly running out of ideas here. Thanks!!

USER.HBM.XML
Code:
<hibernate-mapping package="model">
   <class name="User" table="USER">
      <id name="userId" column="UUID">
         <generator class="native" />
      </id>
      <property name="name" type="text" />
   </class>
</hibernate-mapping>



MEDIA.HBM.XML
Code:
<hibernate-mapping package="model">
   <class name="Media" table="MEDIA">
      <id name="mediaId" column="MEDIAID">
         <generator class="native" />
      </id>
      <property name="name" type="text" />
   </class>
</hibernate-mapping>



USERMEDIA.HBM.XML
Code:
<class name="UserMedia" table="USER_MEDIA">
      <id name="userMediaId" column="USERMEDIAID">
         <generator class="native" />
      </id>
      <one-to-one name="user" class="model.User" />
      <one-to-one name="media" class="model.Media" />
      <property name="rate" type="double" />
      <property name="rateFormat" type="string" column="RATE_FORMAT" />
   </class>


Top
 Profile  
 
 Post subject: Re: Session.save() problem
PostPosted: Thu Sep 16, 2010 3:21 am 
Regular
Regular

Joined: Fri Aug 06, 2010 1:49 am
Posts: 102
Location: shynate26@gmail.com
Check in table USER_MEDIA for column UUID . Its expecting some default value to be set. Also cross check USER & MEDIA tables.

_________________

Cheers!
Shynate
mailto:shynate26@gmail.com
www.CSSCORP.com


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