[jboss-user] [EJB 3.0] - more than one, OneToOne relation gives problem
thiagu.m
do-not-reply at jboss.com
Sat Jan 12 01:20:39 EST 2008
This is my bean class structure
| @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;
|
| @JoinColumn(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 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="SCREEN_SIZE")
| private String screenSize;
|
| . . .
|
| @OneToOne(optional=false)
| @JoinColumn(name="PRODUCT_ID")
| private TblProducts tblProducts;
| }
|
|
|
Here Tblproduct is my main table , I need to make a relation with all other subcategory products table.
But when I try to add the more than one OneToOne relation within product table it gives following error
| java.lang.NullPointerException at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:135) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130) at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:296) at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115) at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1233) at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:869) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:407) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source)
is there any help how to overcome this problem
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119299#4119299
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119299
More information about the jboss-user
mailing list