ejb@glassfish.java.net

question on entity relation. - unidirectional

From: Eve Pokua <gorgeous65_at_msn.com>
Date: Mon, 18 Feb 2008 13:16:11 +0000

hello everyone,
 
I have two entities:
 
public class Iteamdetailsent implements Serializable{
 
@Id @Column(name="ITMID", nullable=false, length=8) private String itmid;
 
....
 
 
And
 
public class Stockinforent implements java.io.Serializable { @Id @Column(name = "ITMID", insertable=false, updatable=false) private String itmid; @OneToOne() @JoinColumn(name="ITMID") private Iteamdetailsent iteamdetailsent;
 
.....
 
Stockinforent does not required an ID of it's own so it is using Iteamdetailsent foriegn key
as it's id. Now I am also using the MVC to get and display data to client. Moreover, I am
also using displaytag as part of my design. Now, I am using a servlet to retrieve data from the entities
and then forwarding data to a JSP to display to client. For example, in my display JSP:
 
 
<display:table name="sessionScope.iteamdetailsent" ..>
 <display:column property="itmid" title=" Itemcode "/> <display:column property="itmname" sortable="true" headerClass="sortable" title=" Name "/> ...
</display:table>
 
 
Now, how do I display data or retrieve data of Stockinforent in relations to Iteamdetailsent?
I am hoping that I won't have to use bi-directional entity relation, as it's so hard to maintain.
Please, help.
 
 
Thanks
 
eve
 
 
 
 
_________________________________________________________________
Telly addicts unite!
http://www.searchgamesbox.com/tvtown.shtml