-->
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: need extrafields from many-to-many relation
PostPosted: Thu Mar 02, 2006 1:18 pm 
Newbie

Joined: Thu Mar 02, 2006 1:04 pm
Posts: 4
Hi all!

I am a new hibernate user, and i am trying to get inside of the hibernate complex world.
Currently i need to do the following. I have 3 tables defined: player, team and player_team_assoc.
The third table (player_team_assoc) was defined to satisfy the needing of have a many-to-many relationship between team and player tables.

Basically the tables structure is like this:

Player Team player_team_assoc
------- ------- -----------------------
(PK)player_id (PK)team_id (PK)team_id
player_name team_name (PK)player_id
is_team_manager

My problem arrives when i try to set the 'is_team_manager' field of the 'player_team_assoc' table to a Player java object in the player hiberante definition.
I have tried everything, i tried to put a composite-element, element, keys, etc, but i cannot find the way to say that i want to load the 'is_team_manager' field to a player object.

In the next lines i attach the bag xml definition of Player and Team elements:

Player definition
-------------------

<bag name="collectionTeams" table="player_team_assoc" inverse="true" cascade="all" lazy="true">
<key column="player_id" />
<many-to-many column="team_id" class="slm.persistence.dao.team.Team" />
</bag>


Team definition
------------------

<bag name="collectionPlayers" table="player_team_assoc" cascade="all" lazy="true">
<key column="team_id" />
<many-to-many column="player_id" class="slm.persistence.dao.player.Player" />
</bag>


The hibernate version iam using is 3.1 and the database is MySql-4.0.16



Since now, THX for any help!! :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 6:43 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
http://forum.hibernate.org/viewtopic.ph ... 62#2294262

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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.