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: one to one mapping to a view
PostPosted: Thu Aug 24, 2006 10:52 pm 
Newbie

Joined: Thu Aug 24, 2006 10:46 pm
Posts: 2
Can i have an one to one mapping from a table to a view?

main table : AAA
primary key : IP_ID

view : BBB
has a field : IP_ID

I try to do a one to one assosiation.
But i got a exception :
NHibernate.MappingException: An association from the table AAA refers to an unmapped class: BBB

Please tell me the solution.
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 10:57 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
If you map an entity onto the view, then yes. If you don't want to map the view, consider using the <join> tag to do this.

Don't forget to mark all properties provided by the view as insert="false" update="false" (unless you're using one of those weird updatable-view DBs).

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 11:34 pm 
Newbie

Joined: Thu Aug 24, 2006 10:46 pm
Posts: 2
Thanks for your kindly response.
But how can i do to use the <join> tag to do this?
Can you give an example?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 25, 2006 12:44 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
I've looked through the Hibernate 2.1 DTD (I think that's what NHibernate uses), and there's no join tag. You're out of luck on that front, sorry. Looks like you'll have to map the view as a separate entity. You can mark it mutable="false" to avoid having to put all those insert="false" update="false" things on each property in the view.

_________________
Code tags are your friend. Know them and use them.


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.