Hello, I am new to the forums and thought i would seek some help on this issue that i have been experiencing for about 2 days now. Hopefully someone has encountered such an issue.
Here is the scenario. I have the two oracle tables.
Using JBoss 4 and JPA 1.0
CarThis Entity has many fields and getters and setters but the important one is this one
Code:
@Id
@Column(name = "CAR_ID", unique = true, nullable = false, precision = 10, scale = 0)
public long getCarId() {
return this.carId;
}
@OneToOne(fetch = FetchType.LAZY, mappedBy = "car")
public CarStatus getCarStatus() {
return this.carStatus;
}
CarStatusAnother entity containing several fields and getters and setters but here are the important ones.
Code:
@GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "car"))
@Id
@GeneratedValue(generator = "generator")
@Column(name = "CAR_ID", unique = true, nullable = false, precision = 10, scale = 0)
public long getCarId() {
return this.carId;
}
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
@NotNull
public Car getCar() {
return this.car;
}
As you can see the CarStatus table has a primary key which is also a foreign key to the Car table.
Does anyone here see why i keep getting the following stacktrace on deployment of the persistent unit?
I have the following exception
Code:
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(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:103)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)