-->
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.  [ 10 posts ] 
Author Message
 Post subject: can't insert to link table in many to many...
PostPosted: Mon Sep 15, 2003 3:39 pm 
Newbie

Joined: Sat Sep 13, 2003 12:47 pm
Posts: 15
Code:
      <collection name="popedoms" lazy="true" table="EXM_ROLE_POPEDOM" cascade="all" role="popedoms">
         <key>
            <column name="ROLE_ID" sql-type="INT(10)"/>
         </key>
         <many-to-many class="cn.mBig.experience.vo.PopedomVO">
            <column name="POPEDOM_ID" sql-type="INT(10)"/>
         </many-to-many>
      </collection>


i got a new RoleVO object, and some PopedomVO's PK in a Long[],
i put all get all exist PopedomVOs and put it to a List, and pass it to RoleVO, and run saveOrUpdate and flush session.

the RoleVO insert success, but nothing in the link table EXM_ROLE_POPEDOM


help me...

Code:
    RoleVO role = (RoleVO) obj;
    PopedomDAO dao = new PopedomDAO(ds);
    if (null != popedoms) {
      List tmp = new ArrayList();
      for (int i = 0; i < popedoms.length; i++) {
        PopedomVO popdom = dao.selectByPK(popedoms[i].longValue());
        tmp.add(popdom);
      }
      role.setPopedoms(tmp);
    }
    session.saveOrUpdate(role);
    session.flush();


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 15, 2003 9:28 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
There is no <collection> element.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 15, 2003 9:52 pm 
Newbie

Joined: Sat Sep 13, 2003 12:47 pm
Posts: 15
i change it to bag , but ... same


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 15, 2003 10:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Try changing:
Code:
<many-to-many class="cn.mBig.experience.vo.PopedomVO">
    <column name="POPEDOM_ID" sql-type="INT(10)"/>
</many-to-many>


to:
Code:
<many-to-many class="cn.mBig.experience.vo.PopedomVO" column="POPEDOM_ID">


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2003 1:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Steve ..... the column element should work? Doesn't it?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2003 2:16 am 
Newbie

Joined: Sat Sep 13, 2003 12:47 pm
Posts: 15
give me some advice , please


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2003 5:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
Steve ..... the column element should work? Doesn't it?

Not sure. I always use the attribute form.

I'll try changing one of mine when I get to work and see what happens.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2003 6:20 am 
Newbie

Joined: Sat Sep 13, 2003 12:47 pm
Posts: 15
use attribute cant use sql-type tag


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2003 8:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
use attribute cant use sql-type tag


I can only think that that would matter on schema generation. If not there, wouldn't the generator tools just look at the sql-type of the id of the related object (which is probabaly what you want anyway). Not reallt sure, as I don't use schema generation. Well, I do, but we call them DBAs ;)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2003 9:58 am 
Newbie

Joined: Sat Sep 13, 2003 12:47 pm
Posts: 15
Code:
<many-to-many class="cn.mBig.experience.vo.PopedomVO" column="POPEDOM_ID">


but , no effect...


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