[jboss-user] [EJB 3.0] - OneToOne relation gives problem

thiagu.m do-not-reply at jboss.com
Sat Jan 19 04:33:28 EST 2008


This is my TBL_PRODUCTS table structure is  

  | PRODUCT_ID       pk
  | PRODUCT_NAME 
  | CATEGORY_NAME
  | SUBCATEGORY_NAME
  | BRAND_NAME
  | 
This is my TBL_CELLPHONE table structure is 
 
  | PRODUCT_ID       pk
  | BLUETOOTH 
  | CAMERA 
  | 
This is my TBL_CELLPHONE table structure is

  | PRODUCT_ID       pk
  | NO_OF_CHANNELS 
  | WOOFERS
  | 
my entity beans are  

  | @Entity
  | @Table(name="TBL_PRODUCTS")
  | public class TblProducts implements Serializable 
  | {
  | 	@Id
  | 	@Column(name="PRODUCT_ID")	
  | 	private BigDecimal productId;	
  | 
  | 	@Column(name="PRODUCT_NAME")	
  | 	private String productName;
  | 
  |                @Column(name="CATEGORY_NAME")		
  | 	private String categoryName;	
  | 
  | 	@Column(name="SUBCATEGORY_NAME")	
  | 	private String subcategoryName;
  | 
  | 	@Column(name="BRAND_NAME")	
  | 	private String brandName;	
  | 
  | 	@OneToOne(fetch=FetchType.LAZY,mappedBy="tblProducts")
  | 	private TblCellphone tblCellphone;
  | 
  | 	@OneToOne(fetch=FetchType.LAZY,mappedBy="tblProducts")
  | 	private TblTelevision tblTelevision;
  | }
  | ------------------------------------------------------------------------------
  | @Entity
  | @Table(name="TBL_CELLPHONE")
  | public class TblCellphone implements Serializable 
  | {
  | 	@Id
  | 	@Column(name="PRODUCT_ID")	
  | 	private BigDecimal productId;			
  | 
  | 	private String bluetooth;		
  | 
  | 	private String camera;
  | 
  | 	OneToOne(optional=false)
  |    	@JoinColumn(name="PRODUCT_ID")   
  | 	private TblProducts tblProducts;
  | }
  | -----------------------------------------------------------------------
  | @Entity
  | @Table(name="TBL_TELEVISION")
  | public class TblTelevision implements Serializable 
  | {
  | 	@Id
  | 	@Column(name="PRODUCT_ID")
  | 	private BigDecimal productId;	
  | 
  | 	@Column(name="NO_OF_CHANNELS")
  | 	private String noOfChannels;
  | 
  | 	private String woofers;	
  | 	
  | 	@OneToOne(optional=false)
  | 	@JoinColumn(name="PRODUCT_ID")	 
  | 	private TblProducts tblProducts;
  | }
  | 
TblProducts is my main table. I try to add OneToOne relation with other tables (TblTelevision and TblCellphone). I cant add more than one relation. If I add it gives incomplete deployment problem. If I remove any one of the OneToOne relation from TblProducts its works fine.
Is there any mistake in my code 
Please help me 

By
Thiagu.m

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121490#4121490

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121490



More information about the jboss-user mailing list