KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have these tables: Which my intention is : A user can be a company or a person but each one of them have something in common, as username which is the email and password , so I used the JPA Tools to generate the entities from the table which result on this: public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) private int id; private String email; private String password; private int reputation; //bi-directional one-to-one association to Company @OneToOne(mappedBy="user", cascade={CascadeType.ALL}) private Company company; //bi-directional many-to-one association to Location @OneToMany(mappedBy="user") private List<Location> locations; //bi-directional one-to-one association to Person @OneToOne(mappedBy="user") private Person person; //bi-directional many-to-one association to Product @OneToMany(mappedBy="user") private List<Product> products; //bi-directional many-to-one association to UserType @ManyToOne @JoinColumn(name="type") private UserType userType; //bi-directional many-to-one association to UserPhone @OneToMany(mappedBy="user") private List<UserPhone> userPhones; //bi-directional many-to-one association to UserPicture @OneToMany(mappedBy="user") private List<UserPicture> userPictures; //bi-directional many-to-one association to UserSocialNetwork @OneToMany(mappedBy="user") private List<UserSocialNetwork> userSocialNetworks; // getter and setters } Now if I try to persist an user object launchs the follow exception in EclipseLink: Exception [EclipseLink-48] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.e
Tags (comma-separated)
Save Edits
Cancel