-->
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: ISet won't get filled
PostPosted: Mon Feb 20, 2012 11:32 am 
Newbie

Joined: Thu Dec 01, 2011 10:47 am
Posts: 4
My db:
---------------
Currency
-Name (PK)
-Value
-.....
---------------
---------------
OldCurrencies
-id (PK)
-name (FK)
-value
---------------

Code:
public class Currency
    {
        public virtual ISet<CurrencyHistorical> Historicals{ get; set; }

        public virtual string Name { get; set; }
        public virtual string Symbol { get; set; }
.................

Code:
public class CurrencyHistorical
    {
        public virtual int Id { get; set; }
        public virtual string Name { get; set; }
        public virtual string Value { get; set; }


And the mapping Files.
Code:
<class name="Currency" table="tblWaehrung">
    <id name ="Name" column="name">
      <generator class="identity" />
    </id>

    <property name="Value" column="wert" />
...........
    <set name="Historicals">
      <key  column="name" />
      <one-to-many   class="CurrencyHistorical" />
    </set>
  </class>


Code:
class name="CurrencyHistorical" table="tblWaehrungHistorisch">
    <id name="Id" column="id">
      <generator class="identity" />
    </id>
    <property name="Name" column="name" />
    <property name="Value" column="wert" />
    <property name="Date" column="kursDatum" />
  </class>


And now my problem. in my code i Load a currency with cur = session.Get<Currency>('EUR');.
works fine so far.
Then i want to access the ISet by cur.Hisorical.Count.
Now Count is always 0, but when i do the query directly on my db i get some rows.
why doesn't my ISet get filled?


Top
 Profile  
 
 Post subject: Re: ISet won't get filled
PostPosted: Wed Feb 22, 2012 8:06 am 
Newbie

Joined: Thu Dec 01, 2011 10:47 am
Posts: 4
Now i profiled it and can see, that the OldCurrency-Entity is created, just the ISet is noch populated.
also tried it with IList and <bag>, doesnt change anything..


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.