Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Problem having 2 different models
Problem having 2 different models [message #692417] Mon, 04 July 2011 11:59
AmFreak Missing name is currently offline AmFreak Missing nameFriend
Messages: 25
Registered: June 2011
Junior Member

i have a problem with my model. I have 2 database tables: projects and persons. They have a many to many relationship. My model looks like this:

In class Project i save a list of Persons in this Project:
private List<Person> persons;
other properties like name, description, etc ...

In class ProjectsModel i save the list of all Projects:
private List<Project> projects = new ArrayList<Project>();
private void readProjects() {
		Query query = em.createQuery("select p from Project p");
		projects = query.getResultList();

In class PersonsModel i save the list of all Persons:
private List<Project> persons = new ArrayList<Person>();
private void readPersons() {
		Query query = em.createQuery("select p from Person p");
		this.persons = query.getResultList();

And a Person class of course with properties of a person.

Cause of the queries i now have 2 different models. Changing a property of a Person from the PersonsModel instance doesn't change the persons property in a personslist in a project. But how can i solve this?
Previous Topic:ManyToMany mapping leads to duplicate entry error in join table, why is it?
Next Topic: Translating PersistenceException to DataAccessException with EclipseLinkJpaDialect
Goto Forum:

Current Time: Sat Apr 17 15:58:06 GMT 2021

Powered by FUDForum. Page generated in 0.01605 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top