Hi all, been combing the examples/books and getting stuck on something simple, but can't find something simple that meets my needs. please help if you could.
I am trying to get my
entityManager.persist( mailboxBean );
to work and it is getting an issue where i think the join
between 2 tables is not annotated correctly.
the
mailboxLaunchId is the PK in MailboxBean (class/table)
and joins with EmailAddress via
mailboxLaunchId I have a class
Code:
@Entity
@Name("mailboxBean")
@Table(name = "MAILBOX_LAUNCH")
public class MailboxBean implements Serializable
{
@Id @GeneratedValue
@Column(name = "MAILBOX_LAUNCH_ID")
private Long mailboxLaunchId = null;
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "MAILBOX_LAUNCH_ID")
private List <EmailAddress> emailAddresses;
}
so the above class has a collection of these objects
Code:
@Entity
@Name("emailAddress")
@Table(name = "MAILBOX_LAUNCH_EMAIL_ADDRESS")
public class EmailAddress implements Serializable
{
@Id @GeneratedValue
@Column(name = "EMAIL_ADDRESS_ID")
private Long emailAddressId;
@Column(name = "MAILBOX_LAUNCH_ID")
private Long mailboxLaunchId;
}
when i call persit(mailboxBean); and that mailboxBean
has some EmailAddress objects in it emailAddresses property, i get
Caused by java.sql.BatchUpdateException with message: "ORA-01400: cannot insert NULL into ("MB_LAUNCH"."MAILBOX_LAUNCH_EMAIL_ADDRESS"."MAILBOX_LAUNCH_ID") " can tell me what annotation i am missing to get this to work. seems like EmailAddress property mailboxLaunchId (a FK from MailboxLaunch)
is null in my bean, but i was thinking hibernate would take care of this, but i am missing
something to enable this type of batch update.
thanks