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
Hi,

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:(no subject)
Next Topic:deploy .ear w/ JPA 2.0 provider=EclispeLink to WLS 10.3.1
Goto Forum:
  


Current Time: Mon Oct 23 04:42:07 GMT 2017

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

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