-->
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: Fileattachment
PostPosted: Mon May 14, 2007 12:07 am 
Newbie

Joined: Mon Mar 26, 2007 7:50 am
Posts: 18
Hibernate version:
3.2
Mapping documents:
Code:
<class name="main.org.jboss.portlet.milestone.spring.dto.EntryValues"
      table="entryValues" >
      <id column="id" name="id">
         <generator class="increment" />
      </id>
      <property name="value" column="value" type="string" not-null="false" />
      <property name="value_bool" column="value_bool" type="boolean" not-null="false" />
      <property name="value_date" column="value_date" type="date" not-null="false" />
      <!--<property name="value_file" column="value_file" type="main.org.jboss.portlet.milestone.spring.dto.UFile" not-null="false" />-->
      <one-to-one name="value_file" class="main.org.jboss.portlet.milestone.spring.dto.UFile" cascade="save-update"/>
      <property name="selected" column="selected" type="main.org.jboss.portlet.milestone.spring.dto.Pair" not-null="false" />
      <property name="dataType" column="dataType" not-null="false"
         type="main.org.jboss.portlet.milestone.spring.dto.DataType" />
      <list name="values">
         <key column="pair_id" />
         <list-index column="pair_idx" />
         <one-to-many class="main.org.jboss.portlet.milestone.spring.dto.Pair"/>
      </list>
   </class>
   
   <class name="main.org.jboss.portlet.milestone.spring.dto.UFile" table="ufile" lazy="true">
      <id column="id" name="id">
         <generator class="foreign">
               <param name="property">entryValues</param>
           </generator>
      </id>
      <property name="fileName" column="filename" type="string" />
      <property name="contentType" column="contenttype" type="string" />
      <property name="content" column="content" type="blob" />
      <one-to-one name="entryValues" class="main.org.jboss.portlet.milestone.spring.dto.EntryValues" constrained="true"/>
   </class>

Code :
Code:
getHibernateTemplate().save(entry);


Exception:
Code:
2007-05-14 09:34:05,718 FATAL [main.org.jboss.portlet.milestone.spring.persistence.EntryManager] - attempted to assign id from null one-to-one property: entryValues; nested exception is org.hibernate.id.IdentifierGenerationException: attempted to assign id from null one-to-one property: entryValues


Hi all,
I have a little problem with the <one-to-one> Tag ... please help,

thanks in advance,

Omid
[/code]


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.