-->
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.  [ 4 posts ] 
Author Message
 Post subject: many-to-many saves correctly, but reads badly !
PostPosted: Wed May 17, 2006 2:09 pm 
Regular
Regular

Joined: Fri Feb 03, 2006 5:28 pm
Posts: 73
Location: Québec, QC, Canada
Hi folks,

I have a User class and a Group class.
a User can be in many groups and a group can have many users.

Got a User, Group and UserGroup table.

Below is the mapping files for both user and group class. The thing is that it will save correctly. but when trying to use User.Groups.Count, it always return 0.

Any idea?

User.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Com.Progmatik.Filemanager.User, Com.Progmatik.Filemanager.DomainModel" table="Users">
<id name="IdUser" unsaved-value="0" access="nosetter.camelcase-underscore">
<generator class="native" />
</id>

<property name="Email" />
<property name="Username" />
<property name="Password" column="Psswrd" />

<bag name="Groups"
table="GroupUsers"
lazy="true"
cascade="save-update">
<key column="IdUser"/>
<many-to-many class="Com.Progmatik.Filemanager.User, Com.Progmatik.Filemanager.DomainModel" column="IdGroup" />
</bag>

</class>
</hibernate-mapping>


Group.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="Com.Progmatik.Filemanager.Group, Com.Progmatik.Filemanager.DomainModel" table="Groups">
<id name="IdGroup" unsaved-value="0" access="nosetter.camelcase-underscore">
<generator class="native" />
</id>
<property name="Name" />
<property name="Description" />

<bag name="Users"
table="GroupUsers"
inverse="true"
lazy="true"
cascade="save-update">
<key column="IdGroup"/>
<many-to-many class="Com.Progmatik.Filemanager.Group, Com.Progmatik.Filemanager.DomainModel" column="IdUser" />
</bag>

</class>
</hibernate-mapping>



Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 3:10 pm 
Regular
Regular

Joined: Fri Feb 03, 2006 5:28 pm
Posts: 73
Location: Québec, QC, Canada
Any help on this ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 3:52 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
We would need to see debug-level logs to help.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 3:53 pm 
Regular
Regular

Joined: Fri Feb 03, 2006 5:28 pm
Posts: 73
Location: Québec, QC, Canada
you mean log4net logs ?


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