-->
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: Newbie question on collections
PostPosted: Thu Aug 11, 2005 6:03 pm 
Newbie

Joined: Thu Aug 11, 2005 5:58 pm
Posts: 6
Hi there!

I have two tables, one containing the master item and one containing versions for this item. The version table holds a reference to the master table called 'itemid'.

Within nhibernate (0.9.0.0), I created a simple collection mapping

Code:
<bag name="Versions">
  <key column="itemid"/>
  <one-to-many class="nhibernate_test.ItemVersion, nhibernate-test"/>
</bag>


and implemented the corresponding properties into the Item class.

When I run my program, I receive the error message that the attribute 'version0_.itemid' cannot be found. This error message is correct as the attribute is called 'itemid' instead. Why does nhibernate try to locate the attribute under the wrong name? How can I correct this or is this a known issue?

cheers,

Stephan


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 12, 2005 8:51 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
version0_ is just a NHibernate-created alias for the table, look in the FROM clause of the generated SQL to see where it comes from. This means that your problem is either a typo or wrong table or something like that.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 8:01 am 
Newbie

Joined: Thu Aug 11, 2005 5:58 pm
Posts: 6
Hi sergey,

thanks for your reply! As I'm a newbie, could you give me a hint on how to display the SQL query that is raised by the CriteriaImpl.List() invocation?

As version0_ is an alias, did I miss to enter the table name ('ItemVersion') somewhere?

Thanks,

Stephan


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.