This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes JPA and One-to-One blues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA and One-to-One blues" Watch "JPA and One-to-One blues" New topic
Author

JPA and One-to-One blues

André-John Mas
Ranch Hand

Joined: Oct 18, 2008
Posts: 37
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

Joined: Oct 18, 2008
Posts: 37
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA and One-to-One blues
 
Similar Threads
Context Initialization Failed
Struts 2 tutorial errors
The chosen transaction strategy requires access to the JTA TransactionManager
Error book Hibernate Recipes a problemsolution approach(@OneToMany bidirectional Using a Join Table)
Unable to run Spring DHB examples