Hi,
I have been created the following files for my logic
Code:
public class A
{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@Column(name = "ID")
@OneToMany(cascade = CascadeType.ALL)
@OneToOne (mappedBy = "id")
private Integer id;
..
}
public class B
{
@Id
@OneToOne(cascade = CascadeType.ALL)
@PrimaryKeyJoinColumn
private A aId;
...
}
With the above code I am getting error
org.hibernate.MappingException: Could not determine type for: com.sample.common.to.A, at table: B, for columns: [org.hibernate.mapping.Column(id)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:269)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1108)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1293)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
at com.capgent.cpt.service.database.utils.HibernateDatabaseCalls.getDataSource(HibernateDatabaseCalls.java:389)
at com.capgent.cpt.service.database.utils.HibernateDatabaseCalls.executeHql(HibernateDatabaseCalls.java:866)
at com.capgent.cpt.service.database.utils.HibernateDatabaseCalls.testHQL(HibernateDatabaseCalls.java:748)
at com.capgent.cpt.service.database.utils.HibernateDatabaseCalls.main(HibernateDatabaseCalls.java:1229)
if i delete @id from the aId property it works fine, is @Id does not work for the Collection and Object(Pojo) type..