I have the following class:
@Entity()
@Table(name = "user")
public class UserBean extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column
private Long id;
@NotNull(message = "Username cannot be null")
@Column
@Size(min = 4, max = 25, message = "Username can not be empty")
private String username;
@NotNull(message = "First Name cannot be empty")
@Column
@Size(min = 3, max = 30, message = "First Name cannot be less than 3 characters")
private String firstName;
@NotNull(message = "Last Name cannot be empty")
@Column
private String lastName;
@Column
private String provider;
//Getter Setter
And this is the child object that represents that is associated by the userbean identifier:
@Table(name = "user_icons")
@Entity
public class UserBeanIcon implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column
@Lob
private byte[] byteContents;
@OneToOne (cascade = CascadeType.ALL)
//@PrimaryKeyJoinColumn
@JoinColumn(name = "USER_ID", unique = true, insertable = true, updatable = true)
private UserBean userBean;
I recompile Maven and reload the project and generate the tables and the relations in the database. The problem is that the relationship that generates me is a OneToMany and not the OneToOne that I expected ...