-->
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: How to get map with cascade to save
PostPosted: Wed Jun 08, 2005 3:00 am 
Newbie

Joined: Mon May 23, 2005 4:46 am
Posts: 4
First, thank you for hibernate. I'm just getting started, but it looks amazing.

I'm using v3. In my mapping file, I have the following in my mapping file:

Code:
...
<map name="features" table="UserFeatures" cascade="all">
  <key column="Id" />
  <map-key column="word" type="string" />

  <composite-element class="norgould.model.UserFeature">
      <property name="score" type="float" />
      <property name="occurances" type="long" />
  </composite-element>
</map>
...


In my code, I call

Code:
...
feature = new UserFeature();
feature.setScore(1.0f);
feature.setOccurances(1L);
user.getFeatures().put(term, feature);
...


(where user is the object that was loaded in the session).

After the session is flushed and closed, no rows were added to the database.

I checked and user.getFeatures() is a PersistentMap. I'm sure I'm doing something simple wrong, but I'm completely at a loss.

[[If there's no way to make it cascade, is there a way to have it manually?]]

Thank you very much for any help.

Dan


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 10, 2005 1:33 am 
Newbie

Joined: Mon May 23, 2005 4:46 am
Posts: 4
I just tried other cascade modes and that didn't seem to help. I also tried calling flush() first. I did notice that none of the example seem to include this case, so I'm wondering if I'm mistaken and hibernate doesn't actaulyl persist maps?

I'm a bit confused.

Thanks,
Dan


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 18, 2005 10:07 pm 
Newbie

Joined: Fri Jun 17, 2005 4:35 pm
Posts: 3
try session.commit


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.