-->
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.  [ 5 posts ] 
Author Message
 Post subject: Link POJO object with interface
PostPosted: Wed Nov 29, 2006 10:37 am 
Newbie

Joined: Fri Nov 24, 2006 6:33 am
Posts: 11
in my Persistent/distributed framework, I need to define link between objects using Interface object, because the construction of my objects are made by NHibernate, or by my entityManager which dynamically create a proxy to a distant server.

So, my POJO object is like this:

interface IPlayer { ... }

class Player:IPlayer
{
private ITeam team;
}

interface ITeam { .... }
class Team:ITeam
{
private IList<IPlayer> players;
}

and in my configuration, something like this:

<class
name='Player'>
<id> etc...
</id>
<many-to-one
name='Team'
access='field'
outer-join='true' />
</class>

when I load configuration using this code:

System.IO.FileStream stream = new System.IO.FileStream("mapping.hbm.xml", System.IO.FileMode.Open);
cfg.AddInputStream(stream);

everything is good, but when I wrote this:

ISessionFactory factory=cfg.BuildSessionFactory();

I've got an exception like this:

NHibernate.MappingException:An association from the table Player refers to an unmapped class:ITeam

it's not a problem in configuration file, because i don't refer to any interface;

so, what can I do?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 10:49 am 
Beginner
Beginner

Joined: Tue Nov 21, 2006 5:18 am
Posts: 31
Location: Bangalore, India
Hello,

You have to write mapping for your 'Team' class too,

since you have given like this

<many-to-one
name='Team'
access='field'
outer-join='true' />

so, you have give mapping for this too, and for the above add class constraint as 'Team' so its look like

<many-to-one name='team' class='Team'
access='field'
outer-join='true' />

_________________
persist_coder
--credit please if it helps you


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 6:29 pm 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
POJO = Plain Ordinary (Old) Java Object

so your .NET classes can not be called POJO.

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 6:44 pm 
Newbie

Joined: Fri Nov 24, 2006 6:33 am
Posts: 11
pasha wrote:
POJO = Plain Ordinary (Old) Java Object

so your .NET classes can not be called POJO.


I suppose this remark change completely the question ;-)

did you say in .NET PONO or POCO?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 7:07 pm 
Newbie

Joined: Thu Oct 20, 2005 5:17 pm
Posts: 19
Personally, I've just heard POCO used.


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