Hello plexq, it looks like you have missing mappings.
-> You need to declare that both classes are entities with the @Entity annotation.
-> You need to use the @Table annotation to specify the name of the table of the database.
-> The @OneToOne annotation on either side of the mapping or both if you want it to have a bidirectional mapping.
-> By default the JPA annotations are looked on the property fields not on the mutator methods.
-> You may need an id generator strategy for id generation.
With all of the above you will have something like this
Code:
@Entity
@Table(name="foo")
public class Foo {
@Id
private Integer id;
private String data;
// setters/getters
}
@Entity
@Table(name="bar")
public class Bar {
@OneToOne
private Foo foo;
private String data;
// setters /getters
}
Regards,