-->
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.  [ 2 posts ] 
Author Message
 Post subject: One-To-Many With Join Table Problem
PostPosted: Thu Aug 28, 2008 11:36 am 
Newbie

Joined: Tue Aug 26, 2008 10:55 am
Posts: 8
Hello,

I'm facing a strange problem with a one to many relation. I use a join table (see mapping file extract).
When I execute the test code (see appended code), it succesfully stores a recipe and a action. But the join table has no content.
Recipe subclasses the Action class with a union-subclass statement. The Query method persists calls saveOrUpdate from the generated session.

Any help is really appreciated as I searched about 2 hours and found nothing appropriate.

Thanks in advance

Regards

Guenther

Hibernate version:
3.1.3 deployed on Tomcat 6

Mapping documents:
Code:
<set name="actions" table="RECIPECONSISTOFACTION"
   cascade="all">
   <key column="RECIPE_ID" not-null="true" />
   <many-to-many column="ACTION_ID" unique="true"
      class="Action" />
</set>


Test case:
Code:
/*
* create a new recipe
*/
Recipe recipe = new Recipe();
recipe.setName("Biscuit");
recipe.setDescription("A base recipe to create a small cake as base for wiped cream cakes.");
recipe.setImageLocation("pics/biscuit.jpg");
/*
* add a action
*/
Action action = new Action();
action.setName("Add Sugar");
action.setDescription("Add Sugar to the dough.");
recipe.addAction(action);
/*
* create a query and save the thing
*/
RecipeQuery query = new RecipeQuery();
Session session = HibernateUtil.getSessionFactory().openSession();
query.setSession(session);
query.persist(recipe);
session.close();


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 30, 2008 9:41 am 
Newbie

Joined: Tue Aug 26, 2008 10:55 am
Posts: 8
Hi,

has anyone an idea with this please?
Any more information I should give please?

Bye

Guenther


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