Michael,

You don't need to do all that work, just set up the tables with the
association in your modeling tool and make sure you have the <<Entity>>
stereotype applied to the classes and a <<PrimaryKey>> stereotype applied to
your pk field.

When you generate, it should give you what you are looking for.

best,

-b

> -----Original Message-----
> From: Michael Davis [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 03, 2004 4:32 PM
> To: [EMAIL PROTECTED]
> Subject: [Andromda-user] Question about relationships and Hibernate
> 
> 
> Hi,
> 
> I'm pretty new to AndroMDA and Hibernate, so please forgive 
> me if this is a newbie
> question. I've tried to find the answer in the documentation, 
> but I'm stuck.
> 
> Let's say I've got two tables, City and Province. As 
> expected, there is a 1-many
> relationship from City to Province.
> 
> How do I work with that in AndroMDA and Hibernate? I'm not 
> using EJB, just JSP and Servlets.
> 
> I've created the model in Poseidon, and created the 
> relationship with the <<EntityRef>>
> stereotype (even though the AndroMDA doc says that this won't 
> create any Hibernate code).
> 
> My City and Province classes are getting created properly, 
> and they work fine in my web app.
> 
> But I'd like to add a 'province' attribute to the City class, 
> so that in jsp I can write:
> 
> ${city.province.title}
> 
> for example.
> 
> I was going to try the following:
> 
> Write the functions:
> Province getProvince();
> void setProvince( Province p );
> 
> in the CityImpl class, and then write code using the 
> Hibernate classes to fetch the
> appropriate entity.
> 
> Is that the way to go, or is there a simpler way?
> 
> Thanks
> Michael Davis
> Toronto
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
> _______________________________________________
> Andromda-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/andromda-user
> 


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Andromda-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to