-->
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.  [ 5 posts ] 
Author Message
 Post subject: Selective insert and update statements on columns?
PostPosted: Mon Nov 10, 2003 4:53 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
I have a situation where I'd like to have seperate insert and update properties for individual columns in a multicolumn many-to-one statement. Much of my data mapping involves data that is stored and generated at seperate sites. This data has a composite-id with two columns. (sequence_id and site) many-to-one relationships between site data requires both of these columns. However, data between sites is never related, so I end up with many unnecessary "site" columns. For example:

Code:
<class name="com.foo.bar.data.base.SiteDataObject" table="base_site_data_objects">
       
        <composite-id name="id" class="com.foo.bar.data.sites.CompositeSiteID" unsaved-value="any">
            <key-property name="sequenceId" type="long" column="sequence_id"/>
            <key-many-to-one name="site" class="com.foo.bar.data.sites.Site" column="site"/>
        </composite-id>

        <joined-subclass name="com.foo.bar.data.event.MPressionEvent" table="events">
       
            <key><column name="sequence_id"/><column name="site"/></key>

                <many-to-one
                    name="bas"
                    outer-join="true"
                    class="com.foo.bar.data.pms.Bas">
                    <column name="bas_id"/>
                    <column name="bas_site"/> <!-- REDUNDANT! -->
                </many-to-one>

        </joined-subclass>

</class>


It would be nice if I could specify insert="false" and update="false" for just the "bas_site" column , and use the "site" column instead. Hibernate will only let me specify the entire many-to-one relation as insert="false" and update="false".

Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 7:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is not supported and not on the roadmap. I see that it is a sensible case, however.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 10, 2003 7:57 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
Soooooooo? :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 13, 2006 7:13 am 
Newbie

Joined: Fri Dec 01, 2006 7:04 am
Posts: 1
Hi,

something new about that?

I have the same problem:

Code:
/**
    * get sycarCtrlCritere
    */
   @ManyToOne
   @JoinColumns({
      @JoinColumn(name = "FK_SECTION", referencedColumnName = "FK_SECTION",  insertable=false, updatable = false),
       @JoinColumn(name = "NUM_CRIT", referencedColumnName = "NUM_CRIT",  insertable=false, updatable = false)
   })
   public SycarCtrlCritere getSycarCtrlCritere() {
      return this.sycarCtrlCritere;
   }
   
   /**
    * set sycarCtrlCritere
    */
   public void setSycarCtrlCritere(SycarCtrlCritere sycarCtrlCritere) {
      this.sycarCtrlCritere = sycarCtrlCritere;
   }

   /**
    * get sycarSqlAutorisation
    */
   @ManyToOne
   @JoinColumns({
      @JoinColumn(name = "FK_SECTION", referencedColumnName = "FK_SECTION"),
       @JoinColumn(name = "FK_METIER", referencedColumnName = "FK_METIER")
   })
   public SycarSqlAutorisation getSycarSqlAutorisation() {
      return this.sycarSqlAutorisation;
   }
   
   /**
    * set sycarSqlAutorisation
    */
   public void setSycarSqlAutorisation(SycarSqlAutorisation sycarSqlAutorisation) {
      this.sycarSqlAutorisation = sycarSqlAutorisation;
   }


works, but I would like to write:

Code:
   @ManyToOne
   @JoinColumns({
      @JoinColumn(name = "FK_SECTION", referencedColumnName = "FK_SECTION",  insertable=false, updatable = false),
       @JoinColumn(name = "NUM_CRIT", referencedColumnName = "NUM_CRIT")
   })
   public SycarCtrlCritere getSycarCtrlCritere() {
      return this.sycarCtrlCritere;
   }


Of course a solution could be fk_section duplication and creation of an equality constraint, or to drop sycarCtrlCritere composite key and to create a generated key.


Top
 Profile  
 
 Post subject: Re: Selective insert and update statements on columns?
PostPosted: Thu Apr 04, 2013 8:00 am 
Newbie

Joined: Thu Apr 04, 2013 7:58 am
Posts: 1
Hi all,

Do you have any solution for coming over that issue? I also got that issue during my migration.

Regards,
Viet Tran


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