File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA and One-to-One blues

 
André-John Mas
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two tables: user and phone_number. The phone_number id corresponds to the id of the user. A user can have one phone number, and it is optional. I just don't get what I should be doing.

I tried:



What I get is:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openEntityInView' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: org.hibernate.MappingException: Could not determine type for: com.realbusinesses.entity.PhoneNumber, at table: user, for columns: [org.hibernate.mapping.Column(phoneNumber)]

Any help would be appreciated. I am pulling my hair out here. It is probably 'obvious', but I am just not seeing it.
 
André-John Mas
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Turns out the issues was with where I was putting my annotations. Moving them to the public getters and setters in both cases cleared up the issue.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic