This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have 2 tables, EMPLOYEE and ADDRESS. Table EMPLOYEE has ADDRESSID column which has a foreign key relationship with ADDRESS whose primary key is ADDRESSID. Using EJB3.0 java persisatance API I wanted to implement one-to-one unidirectional relationship. Hence I created 2 entity classes, Employee and Address. In the Employee class I putting below the relevant code:
In the Address class, there is no code to access the Employee.
I have created a session bean which tries to create an employee along with an Address. Putting the relevant code below:
As mentioned above, error is being thrown at em.persist(emp);. The error is
I am unable to make out anything from the exception stack trace. Any help in this would be greatly appreciated.