playframework JPA Error and DB design issue -
playframework JPA Error and DB design issue -
i next error:
jpa error jpa error occurred (unable build entitymanagerfactory): @onetoone or @manytoone on models.issue.project references unknown entity: models.project
here can see entities:
package models; import java.util.*; import javax.persistence.*; import play.db.jpa.*; import models.issue; import models.component; public class project extends model{ public string self; @id public string key; @onetomany (mappedby="project", cascade=cascadetype.all) public list<component> components; @onetomany (mappedby="project", cascade=cascadetype.all) public list<issue> issues; public project(string self, string key) { this.self = self; this.key = key; this.components = new arraylist<component>(); this.issues = new arraylist<issue>(); } public project addcomponent(string self, int component_id, string name, int issuecount) { component newcomponent = new component(self, component_id, name, issuecount, this); this.components.add(newcomponent); homecoming this; } public project addissue(date created, date updated, string self, string key, string type, status status) { issue newissue = new issue(created, updated, self, key, type, status, this); this.issues.add(newissue); homecoming this; } }
and other
package models; import java.util.*; import javax.persistence.*; import play.db.jpa.*; import models.project; import models.status; import models.component; @entity public class issue extends model { @id public string key; public date created; public date updated; public string self; public string type; @manytoone public status status; @manytoone public project project; @onetomany public list<component> components; public issue(date created, date updated, string self, string key, string type, status status, project project ) { this.created = created; this.updated = updated; this.self = self; this.key = key; this.status = status; this.type = type; this.project=project; this.components=new arraylist<component>(); } public issue addcomponent(component component) { this.components.add(component); homecoming this; } }
i'm using play 1.2.4 , eclipse. db in mem.
i have sec question. ideally need db each user , want delete content of tables every time user logs in ( or logs out ) , populate table 1 time again when user logs in (this because info stored in db must in synch service i'm connecting ). how should do?
i totally have no clue. please help me.
public class project extends model
is missing @entity
annotation
jpa playframework
Comments
Post a Comment