-->
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.  [ 3 posts ] 
Author Message
 Post subject: Associations question urgently
PostPosted: Wed Mar 16, 2005 4:38 am 
Regular
Regular

Joined: Thu Feb 24, 2005 2:34 pm
Posts: 80
Hibernate version 3:
Hi,
i have a question about association, in my case many-to-one here a bit code.
Code:
<many-to-one name="modevo" class="vo.as400.ModeVO" lazy="false" cascade="save-update" update="false" insert="false">
      <column name="STAGPF"/>   
      <column name="MODEPF"/>
   </many-to-one>



But my association it's not obbligatory, or rather not always exists, but if hibernate don't found this association throws an exception "no row ...".
in few words, as it is possible to say to Hinernate, if this associations not exits don't throws a exception
Can you help me.
Devis


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 16, 2005 7:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Why cascade when your not able to update or save the object?

You need to inform hibernate that is nullable.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 17, 2005 4:53 am 
Regular
Regular

Joined: Thu Feb 24, 2005 2:34 pm
Posts: 80
Why cascade when your not able to update or save the object?

It's true but if i don't put update"false" inserte="false" Hibernate throws me
"duplicate stagpf" and "duplicate modepf".
Then Hibernate write correctly into ModeVO with cascade="save-update"
What is wrong in my mappging?
Devis

[code]

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>


<class name="vo.as400.PfVO" table="sdgtwb_dat.arcpf00f" lazy="false"

dynamic-update="true"
dynamic-insert="true"


>




<composite-id name="pfvopk" class="vo.pk.PfVOPK">
<key-property name="stagpf" column="stagpf" type="string"/>
<key-property name="modepf" column="modepf" type="string"/>
<key-property name="matepf" column="matepf" type="string"/>
</composite-id>



<property name="strepf" column="strepf" type="dao.hibernate.TrimmedString"/>
<property name="nrazpf" column="nrazpf"/>
<property name="dtumpf" column="dtumpf"/>
<property name="orumpf" column="orumpf"/>
<property name="blrepf" column="blrepf" type="dao.hibernate.TrimmedString"/>
<property name="de50pf" column="de50pf" type="dao.hibernate.TrimmedString"/>
<property name="cartpf" column="cartpf" type="dao.hibernate.TrimmedString"/>
<property name="marcpf" column="marcpf" type="dao.hibernate.TrimmedString"/>
<property name="linepf" column="linepf" type="dao.hibernate.TrimmedString"/>
<property name="slinpf" column="slinpf" type="dao.hibernate.TrimmedString"/>


<property name="cmp1pf" column="cmp1pf" type="dao.hibernate.TrimmedString"/>
<property name="cmp2pf" column="cmp2pf" type="dao.hibernate.TrimmedString"/>
<property name="cmp3pf" column="cmp3pf" type="dao.hibernate.TrimmedString"/>
<property name="cdogpf" column="cdogpf" type="dao.hibernate.TrimmedString"/>
<property name="civapf" column="civapf" type="dao.hibernate.TrimmedString"/>
<property name="cnvepf" column="cnvepf" type="dao.hibernate.TrimmedString"/>
<property name="cnaqpf" column="cnaqpf" type="dao.hibernate.TrimmedString"/>
<property name="peunpf" column="peunpf"/>
<property name="volupf" column="volupf"/>
<property name="cma1pf" column="cma1pf" type="dao.hibernate.TrimmedString"/>
<property name="cma2pf" column="cma2pf" type="dao.hibernate.TrimmedString"/>
<property name="cma3pf" column="cma3pf" type="dao.hibernate.TrimmedString"/>
<property name="cma4pf" column="cma4pf" type="dao.hibernate.TrimmedString"/>
<property name="cma5pf" column="cma5pf" type="dao.hibernate.TrimmedString"/>
<property name="qmxbpf" column="qmxbpf"/>
<property name="scmnpf" column="scmnpf"/>
<property name="ltripf" column="ltripf"/>
<property name="coaqpf" column="coaqpf"/>
<property name="coulpf" column="coulpf"/>
<property name="ggcupf" column="ggcupf"/>
<property name="mmcupf" column="mmcupf"/>
<property name="aacupf" column="aacupf"/>
<property name="socupf" column="socupf"/>

<property name="ricopf" column="ricopf" type="dao.hibernate.TrimmedString"/>
<property name="ftcopf" column="ftcopf" type="dao.hibernate.TrimmedString"/>
<property name="flicpf" column="flicpf" type="dao.hibernate.TrimmedString"/>
<property name="fptgpf" column="fptgpf" type="dao.hibernate.TrimmedString"/>
<property name="fla1pf" column="fla1pf" type="dao.hibernate.TrimmedString"/>
<property name="fla2pf" column="fla2pf" type="dao.hibernate.TrimmedString"/>
<property name="fla3pf" column="fla3pf" type="dao.hibernate.TrimmedString"/>
<property name="fla5pf" column="fla4pf" type="dao.hibernate.TrimmedString"/>

<property name="fla6pf" column="fla6pf" type="dao.hibernate.TrimmedString"/>
<property name="fla7pf" column="fla7pf" type="dao.hibernate.TrimmedString"/>
<property name="fla8pf" column="fla8pf" type="dao.hibernate.TrimmedString"/>
<property name="fl10pf" column="fl10pf" type="dao.hibernate.TrimmedString"/>
<property name="fl20pf" column="fl20pf" type="dao.hibernate.TrimmedString"/>
<property name="fl30pf" column="fl30pf" type="dao.hibernate.TrimmedString"/>

<property name="ceaqpf" column="ceaqpf"/>
<property name="ceulpf" column="ceulpf"/>

<property name="fl31pf" column="fl31pf" type="dao.hibernate.TrimmedString"/>
<property name="fl32pf" column="fl32pf" type="dao.hibernate.TrimmedString"/>
<property name="fl33pf" column="fl33pf" type="dao.hibernate.TrimmedString"/>
<property name="fl34pf" column="fl34pf" type="dao.hibernate.TrimmedString"/>
<property name="fl35pf" column="fl35pf" type="dao.hibernate.TrimmedString"/>
<property name="fl36pf" column="fl36pf" type="dao.hibernate.TrimmedString"/>
<property name="fl37pf" column="fl37pf" type="dao.hibernate.TrimmedString"/>
<property name="fl38pf" column="fl38pf" type="dao.hibernate.TrimmedString"/>
<property name="fl39pf" column="fl39pf" type="dao.hibernate.TrimmedString"/>
<property name="fl40pf" column="fl40pf" type="dao.hibernate.TrimmedString"/>
<property name="fl41pf" column="fl41pf" type="dao.hibernate.TrimmedString"/>
<property name="fl42pf" column="fl42pf" type="dao.hibernate.TrimmedString"/>
<property name="fl43pf" column="fl43pf" type="dao.hibernate.TrimmedString"/>
<property name="fl44pf" column="fl44pf" type="dao.hibernate.TrimmedString"/>
<property name="fl45pf" column="fl45pf" type="dao.hibernate.TrimmedString"/>
<property name="fl46pf" column="fl46pf" type="dao.hibernate.TrimmedString"/>
<property name="fl47pf" column="fl47pf" type="dao.hibernate.TrimmedString"/>
<property name="fl48pf" column="fl48pf" type="dao.hibernate.TrimmedString"/>
<property name="fl49pf" column="fl49pf" type="dao.hibernate.TrimmedString"/>



<many-to-one name="stagione" class="vo.as400.CStagione" lazy="false" update="false" insert="false">
<formula>'STG'</formula>
<column name="STAGPF"/>
</many-to-one>

<many-to-one name="modevo" class="vo.as400.ModeVO" lazy="false" cascade="save-update" not-null="true" update="false" insert="false">
<column name="STAGPF"/>
<column name="MODEPF"/>
</many-to-one>



</class>
</hibernate-mapping>

/code]


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